[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

How to call system having trap("CHLD", "IGNORE")?

Pavel Smerk

7/17/2006 5:52:00 PM

Hi all,

doing some forks I want to ignore SIGCHLD. But

trap("CHLD", "IGNORE")
system "echo"

ends in ruby 1.8.2 (2005-04-11) [i386-linux] with a following error:

in `system': no implicit conversion from nil to integer (TypeError)

Where I am wrong?

Thanks,

P.
2 Answers

Ara.T.Howard

7/17/2006 7:52:00 PM

0

Yukihiro Matsumoto

7/18/2006 5:38:00 AM

0

Hi,

In message "Re: How to call system having trap("CHLD", "IGNORE")?"
on Tue, 18 Jul 2006 03:05:07 +0900, Pavel Smerk <smerk@fi.muni.cz> writes:

|doing some forks I want to ignore SIGCHLD. But
|
|trap("CHLD", "IGNORE")
|system "echo"
|
|ends in ruby 1.8.2 (2005-04-11) [i386-linux] with a following error:
|
|in `system': no implicit conversion from nil to integer (TypeError)
|
|Where I am wrong?

system() tried to pick up the exit status of forked sub-process.
Since you've set SIG_IGN sub-process disappeared without notice to
wait(2) system call, which failed and caused an error you've seen.
What did you try to accomplish by ignoring SIGCHLD?

It is fairly easy to make system to ignore wait(2) error, but I am not
sure it is the way to go.

matz.