2011年12月28日

Ruby获取进程ID的问题

摘要: 以下代码在Ruby 1.8.6下测试通过CODE:require 'sys/proctable'include SysProcTable.ps{ |p| puts p.pid.to_s if p.comm=='explorer.exe' #替换为需要的进程名} 阅读全文

posted @ 2011-12-28 16:04 wofengletian 阅读(551) 评论(0) 推荐(0)

转:C中调用shell的方法

摘要: C程序调用shell脚本共有三种法子 :system()、popen()、exec系列函数call_exec1.c ,内容为:system() 不用你自己去产生进程,它已经封装了,直接加入自己的命令exec 需要你自己 fork 进程,然后exec 自己的命令popen() 也可以实现执行你的命令,比system 开销小1)system(shell命令或shell脚本路径);system() 会调用fork()产生 子历程,由子历程来调用/bin/sh-c string来履行 参数string字符串所代表的命令,此命令履行 完后随即返回原调用的历程。在调用system()期间SIGCHLD 信 阅读全文

posted @ 2011-12-28 16:01 wofengletian 阅读(244) 评论(0) 推荐(0)

转:六种用ruby调用执行shell命令的方法

摘要: ruby shell 阅读全文

posted @ 2011-12-28 15:58 wofengletian 阅读(187) 评论(0) 推荐(0)

导航