Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
您好,我正在尝试使用 system( kill -9 @pid)通过 pid 杀死进程,在 ruby@pid 中@pid = %x[pidof program firefox]有什么方法可以做到这一点?
kill -9 @pid
@pid
@pid = %x[pidof program firefox]
还没有真正尝试过,但如果有帮助,您可以看看它:
RAA - 系统可处理
它应该工作。尝试
command = "kill -9 #{@pid}" system(command)
反引号:
`kill -9 #{@pid}`
纯红宝石:
http://www.ruby-doc.org/core-1.9.3/Process.html#method-c-kill