Forum: Ruby-core unable to send signal "EXIT"

9887130ab70f6e66b50f2c5e19272c67?d=identicon&s=25 Roger Pack (Guest)
on 2009-12-17 05:03
(Received via mailing list)
Is this expected? (all versions of ruby...)

>> Process.kill "EXIT", 13072
ArgumentError: unsupported name `SIGEXIT'
        from (irb):7:in `kill'
        from (irb):7
        from ♥:0

Thanks.
-r
8cbb39dadafaf2287a83a13ee4981ec9?d=identicon&s=25 U.Nakamura (Guest)
on 2009-12-17 05:23
(Received via mailing list)
Hello,

"EXIT" is special pseudo signal to trap program termination.
So, you can use it for Signal.trap, but not to invoke by
the name.


In message "[ruby-core:27205] unable to send signal "EXIT""
    on Dec.17,2009 12:58:12, <rogerdpack@gmail.com> wrote:
> Is this expected? (all versions of ruby...)
>
> >> Process.kill "EXIT", 13072
> ArgumentError: unsupported name `SIGEXIT'
>         from (irb):7:in `kill'
>         from (irb):7
>         from ?:0
>
> Thanks.
> -r

Regards,
9887130ab70f6e66b50f2c5e19272c67?d=identicon&s=25 Roger Pack (Guest)
on 2009-12-17 06:52
(Received via mailing list)
> "EXIT" is special pseudo signal to trap program termination.
> So, you can use it for Signal.trap, but not to invoke by
> the name.

Ok.  I might submit a patch to the rdoc's sometime about it.
Thanks!
-r
9887130ab70f6e66b50f2c5e19272c67?d=identicon&s=25 Roger Pack (Guest)
on 2009-12-18 01:36
(Received via mailing list)
> "EXIT" is special pseudo signal to trap program termination.
> So, you can use it for Signal.trap, but not to invoke by
> the name.

Interestingly, you can send a 0

>> Process.kill 0, 3752
=> 1

and it works as expected (after process 3752 goes away, sending 0
results in an exception, as it should).

>> Process.kill "EXIT", 3752
ArgumentError: unsupported name `SIGEXIT'


I wonder if something couldn't be done to clean up this messy edge
case...
Thoughts?
-r
E7559e558ececa67c40f452483b9ac8c?d=identicon&s=25 Gary Wright (Guest)
on 2009-12-18 21:37
(Received via mailing list)
On Dec 17, 2009, at 7:35 PM, Roger Pack wrote:

> results in an exception, as it should).
Sending signal 0 is a standard Unix idiom for testing for the existence
of the target process (failure => ESRCH) and/or the capability to send a
signal to the process (failure => EPERM). It never actually delivers a
signal to the target process.

Gary Wright
9887130ab70f6e66b50f2c5e19272c67?d=identicon&s=25 Roger Pack (Guest)
on 2009-12-18 22:49
(Received via mailing list)
> Sending signal 0 is a standard Unix idiom for testing for the existence of the target 
process (failure => ESRCH) and/or the capability to send a signal to the process (failure 
=> EPERM). It never actually delivers a signal to the target process.

Interesting.  It also behaves this way in windows.
-r
Bec38d63650c8912b6ba9b557fb953b9?d=identicon&s=25 Roger Pack (rogerdpack)
on 2012-09-27 02:05
Also note that you can use Signal.list as a lookup, like

>> Process.kill Signal.list['EXIT'], Process.pid
This topic is locked and can not be replied to.