Ajedi32
Ajedi32

Reputation: 48388

What Process.kill signals are available on Windows?

From the documentation for Process.kill:

Sends the given signal to the specified process id(s) if pid is positive. If pid is zero signal is sent to all processes whose group ID is equal to the group ID of the process. signal may be an integer signal number or a POSIX signal name (either with or without a SIG prefix). If signal is negative (or starts with a minus sign), kills process groups instead of processes. Not all signals are available on all platforms.

Okay, that's pretty vague. Which signals are available on what platforms? Are there any signals available on Windows?

(I tried Process.kill(9, pid) on Windows before and it didn't throw an error. It didn't kill the process either though... But Process.kill("TERM", pid) did throw an error. Go figure.)

Upvotes: 10

Views: 4426

Answers (2)

Ajedi32
Ajedi32

Reputation: 48388

I think I found a solution. To find out what signals your current platform supports, run this:

ruby -e "puts Signal.list"

On Windows:

{"EXIT"=>0, "INT"=>2, "ILL"=>4, "ABRT"=>22, "FPE"=>8, "KILL"=>9, "SEGV"=>11, "TERM"=>15}

Upvotes: 17

Keval Doshi
Keval Doshi

Reputation: 748

In this article

http://blog.robseaman.com/2008/12/12/sending-ctrl-c-to-a-subprocess-with-ruby

There is good mention of process.kill and its turn-around mechanism

Upvotes: 1

Related Questions