wrong exitstatus returned?

Discussion in 'Perl Misc' started by Frank de Bot, Apr 8, 2004.

  1. Frank de Bot

    Frank de Bot Guest

    Hi,

    I have a perl script server which works with fork. But I got a problem
    with executing commands from a child which handles a request. The
    exitstatus $? is always -1 I've tried execute commands with system and
    `command` but nothing matters.
    What can be wrong?

    Thanks in advanced,

    Frank de bot
    Frank de Bot, Apr 8, 2004
    #1
    1. Advertising

  2. Frank de Bot

    Joe Smith Guest

    Frank de Bot wrote:

    > I have a perl script server which works with fork. But I got a problem
    > with executing commands from a child which handles a request. The
    > exitstatus $? is always -1 I've tried execute commands with system and
    > `command` but nothing matters.


    Linux?
    Win32?
    Win32 with cygwin?
    Joe Smith, Apr 8, 2004
    #2
    1. Advertising

  3. Frank de Bot

    Frank de Bot Guest

    Linux

    I found out that $? won't function if the SIGCHLD handler is set, which
    it is. I've found a very rude way to solve this problem by adding the
    exit status via another script in front of the stdout of command I want
    to run.
    But I don't realy like this method, any suggestion?




    Joe Smith wrote:
    > Frank de Bot wrote:
    >
    >> I have a perl script server which works with fork. But I got a problem
    >> with executing commands from a child which handles a request. The
    >> exitstatus $? is always -1 I've tried execute commands with system and
    >> `command` but nothing matters.

    >
    >
    > Linux?
    > Win32?
    > Win32 with cygwin?
    Frank de Bot, Apr 8, 2004
    #3
  4. Frank de Bot

    Anno Siegel Guest

    Frank de Bot <ppi_doesnt_like_@spam_inhis_email_searchy.net> wrote in comp.lang.perl.misc:
    > > Frank de Bot wrote:


    [please don't top-post. lines rearranged]

    > >> I have a perl script server which works with fork. But I got a problem
    > >> with executing commands from a child which handles a request. The
    > >> exitstatus $? is always -1 I've tried execute commands with system and
    > >> `command` but nothing matters.

    > >
    > >
    > > Linux?
    > > Win32?
    > > Win32 with cygwin?


    > Linux
    >
    > I found out that $? won't function if the SIGCHLD handler is set, which
    > it is. I've found a very rude way to solve this problem by adding the
    > exit status via another script in front of the stdout of command I want
    > to run.
    > But I don't realy like this method, any suggestion?


    If you have a handler, use it. See "perldoc -f waitpid".

    Anno
    Anno Siegel, Apr 19, 2004
    #4
    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. Alex
    Replies:
    1
    Views:
    407
    Thomas Weidenfeller
    Apr 1, 2004
  2. Laszlo Zsolt Nagy

    pexpect.exitstatus not working?

    Laszlo Zsolt Nagy, Sep 1, 2005, in forum: Python
    Replies:
    0
    Views:
    488
    Laszlo Zsolt Nagy
    Sep 1, 2005
  3. Laszlo Zsolt Nagy

    Re: pexpect.exitstatus not working?

    Laszlo Zsolt Nagy, Sep 1, 2005, in forum: Python
    Replies:
    0
    Views:
    857
    Laszlo Zsolt Nagy
    Sep 1, 2005
  4. chiranjeevi muttoju
    Replies:
    1
    Views:
    2,512
    Philip Semanchuk
    Feb 15, 2010
  5. warhero
    Replies:
    4
    Views:
    223
    James Britt
    Jan 11, 2007
Loading...

Share This Page