我正在运行后台 rake 任务。(使用 '&')。问题是我希望它有时停止。所以我写了这个:
pinger_pid = system "ps | grep rake | awk '{print $1}'"
puts pinger_pid
system "kill -9 #{pinger_pid}"
似乎我得到了一个“真正的”输出垃圾!我怎样才能删除它?
输出:
ERROR: garbage process ID "true".
Usage:
kill pid ... Send SIGTERM to every process listed.
kill signal pid ... Send a signal to every process listed.
kill -s signal pid ... Send a signal to every process listed.
kill -l List all signal names.
kill -L List all signal names in a nice table.
kill -l signal Convert between signal numbers and names.