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

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

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

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:
    833
    Tor Bådshaug
    Jun 12, 2006
  2. Dan Janowski

    trap() block signal mask, esp. CHLD

    Dan Janowski, Feb 8, 2005, in forum: Ruby
    Replies:
    0
    Views:
    125
    Dan Janowski
    Feb 8, 2005
  3. 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:
    124
    Sébastien Cottalorda
    Aug 1, 2003
  4. Heinrich Mislik

    $SIG{CHLD} and system

    Heinrich Mislik, Sep 30, 2004, in forum: Perl Misc
    Replies:
    5
    Views:
    159
    Heinrich Mislik
    Oct 1, 2004
  5. axeman
    Replies:
    5
    Views:
    124
    axeman
    Apr 13, 2006
Loading...

Share This Page