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

Discussion in 'Ruby' started by Pavel Smerk, Jul 17, 2006.

  1. Pavel Smerk

    Pavel Smerk Guest

    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.
     
    Pavel Smerk, Jul 17, 2006
    #1
    1. Advertisements

  2. Pavel Smerk

    Guest

    On Tue, 18 Jul 2006, Pavel Smerk wrote:

    > 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
    --
    suffering increases your inner strength. also, the wishing for suffering
    makes the suffering disappear.
    - h.h. the 14th dali lama
     
    , Jul 17, 2006
    #2
    1. Advertisements

  3. Hi,

    In message "Re: How to call system having trap("CHLD", "IGNORE")?"
    on Tue, 18 Jul 2006 03:05:07 +0900, Pavel Smerk <> 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.
     
    Yukihiro Matsumoto, Jul 18, 2006
    #3
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Deepika

    trap and ignore invalid viewstate

    Deepika, Jun 12, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    886
    Tor Bådshaug
    Jun 12, 2006
  2. lallous

    How can I trap an API call by windows

    lallous, Dec 17, 2003, in forum: C Programming
    Replies:
    6
    Views:
    547
    Ben Pfaff
    Dec 18, 2003
  3. Rob Meade
    Replies:
    6
    Views:
    458
    Rob Meade
    Mar 1, 2004
  4. Dan Janowski

    trap() block signal mask, esp. CHLD

    Dan Janowski, Feb 8, 2005, in forum: Ruby
    Replies:
    0
    Views:
    215
    Dan Janowski
    Feb 8, 2005
  5. Sébastien Cottalorda

    Pb $SIG{CHLD}=sub{wait()}; in Perl 5.8.0

    Sébastien Cottalorda, Aug 1, 2003, in forum: Perl Misc
    Replies:
    1
    Views:
    201
    Sébastien Cottalorda
    Aug 1, 2003
  6. Heinrich Mislik

    $SIG{CHLD} and system

    Heinrich Mislik, Sep 30, 2004, in forum: Perl Misc
    Replies:
    5
    Views:
    257
    Heinrich Mislik
    Oct 1, 2004
  7. axeman
    Replies:
    5
    Views:
    258
    axeman
    Apr 13, 2006
  8. Eric Pozharski

    Selective $SIG{CHLD}

    Eric Pozharski, Nov 23, 2010, in forum: Perl Misc
    Replies:
    0
    Views:
    161
    Eric Pozharski
    Nov 23, 2010
Loading...