windows - Kill a process using its PID in ruby -
i'm trying kill process using pid after given period of time, i.e, if process keeps running more 10 minutes, have call method kill it.
i have 2 problems: first, can't manage kill process, i'm using:
process.kill('int', pid)
but errors keep popping bad file descriptor
, or unsupported name 'sigquit'
when use quit
signal instead of int
.
second, how make 10 minutes timer before call method kill process?
thanks.
for timing, can use thread:
thread.new sleep 10 * 60 begin process.kill('quit', pid) rescue errno::esrch # process exited end end _, status = process.wait2 pid puts status.exited?
i unsure of why quit not working you. not replicate error.
Comments
Post a Comment