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

P

Pavel Smerk

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.
 
A

ara.t.howard

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.

it looks like a bug.

try

trap('SIGCHLD'){ nil }

-a
 
Y

Yukihiro Matsumoto

Hi,

In message "Re: How to call system having trap("CHLD", "IGNORE")?"

|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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top