有一個IO.popen命令被殺死。我希望他們在整個過程中喪生時被殺害。從testacular我有一個啓動子的Ruby腳本時,呼叫者進程被終止
user.name:/my/repo [git: my-branch] $ ruby my-script.rb
輸出:
IO.popen('testacular start unit.conf.js', 'w')
運行我的腳本
user.name:/my/repo [git: my-branch] $ info: Testacular server started at http://localhost:8000/
info (launcher): Starting browser PhantomJS
info (PhantomJS 1.7): Connected on socket id uVAO41Q2niyLA8AqbZ8w
PhantomJS 1.7: Executed 44 of 44 SUCCESS (0.213 secs/0.115 secs)
按下Control-C殺死進程。檢查正在運行的進程:
user.name:/my/repo [git: my-branch] $ ps
PID TTY TIME CMD
# ...
39639 ttys019 0:01.28 node /usr/local/bin/testacular start unit.conf.js
39649 ttys019 0:00.09 node /usr/local/bin/phantomjs /var/folders/2p/dklw3xys2n3f4hqmx73zvz6w0000gp/T/testacular-61981618/capture.js
39650 ttys019 0:00.82 /usr/local/lib/node_modules/phantomjs/lib/phantom/bin/phantomjs /var/folders/2p/dklw3xys2n3f4hqmx73zvz6w0000gp/T/testacular-61981618/capture.js
我們可以看到testacular進程仍在運行。
手動殺死它,看到了典型的testacular關斷輸出:
user.name:/my/repo [git: my-branch] $ kill 39639
info: Disconnecting all browsers
error (launcher): Cannot start PhantomJS
user.name:/my/repo [git: my-branch] $
有沒有一種方法,使IO.popen
電話,這樣我就不必手動殺testacular
以後呢?
真棒,謝謝! –