From: "ara.t.howard" Date: 2007-12-29T06:41:32+09:00 Subject: Re: portable signals On Dec 28, 2007, at 10:39 AM, Luis Lavena wrote: > > Ara, did you checked the C code of Ruby? maybe there is some room we > can improve it, according to MSDN docs, the following signals are > being available to be defined: > > SIGABRT: Abnormal termination > SIGFPE: Floating-point error > SIGILL: Illegal instruction > SIGINT: CTRL+C signal > SIGSEGV: Illegal storage access > SIGTERM: Termination request > > But (there is always a but): > > The SIGILL and SIGTERM signals are not generated under Windows NT. > They are included for ANSI compatibility. Thus you can set signal > handlers for these signals with signal, and you can also explicitly > generate these signals by calling raise. > > http://msdn2.microsoft.com/en-us/library/xdkz3x12(VS.80).aspx > > So, any other signal cannot be generated from other software that is > not ruby. Ruby exposes the list of signals available, but not all are > supported by the platform (so is impossible send a ABRT signal to > other process). > > I'm getting it wrong? > > Looking forward for your thoughts, > > Luis you can generate and trap signals in windows using ruby - but *only for the same process*. in otherwords, currently in ruby, process A cannot send a signal to process B, A may only send signals to itself. at least this is how i'm interpreting this code http://groups.google.com/group/ruby-talk-google/browse_frm/thread/ e8478acbffe804cb which sets up two processes - one trapping all signals and the other trying to send those same signals. the result of trying to send the signal is always EINVAL. perhaps i'm missing something - in fact i'd be very happy to be proven wrong here (likely as i know nothing about windows) but my current understanding is that, under windows, signals cannot be sent process to process. my drb hack gets around that by allowing one process to cause another process to signal *itself*. i've tried using two irb sessions too irb_0 > puts $$ 1234 irb_1 > Process.kill 'TERM', 1234 all signals except 9, which cannot be trapped, cause Errno::EINVAL to be raised in the process attempting to signal. can you show me an example of one process signaling another in ruby? cheers. a @ http://codeforpeople.com/ -- it is not enough to be compassionate. you must act. h.h. the 14th dalai lama