in reply to Re: Function for Timing out shell commands without getting Zombie Prozesses
in thread Function for Timing out shell commands without getting Zombie Prozesses

don't work, getting Can't kill a non-numeric process ID at ./t.pl line 36.

  • Comment on Re^2: Function for Timing out shell commands without getting Zombie Prozesses

Replies are listed 'Best First'.
Re^3: Function for Timing out shell commands without getting Zombie Prozesses
by BrowserUk (Patriarch) on Sep 15, 2011 at 19:03 UTC
    Can't kill a non-numeric process ID at ./t.pl line 36.

    Being as the script I linked to only has 35 lines, you must have changed something.

    Given the reference to "kill", it would have to be one of these two lines producing the error:

    kill 0, $pid while sleep 1 and $timeout--; kill 3, $pid and return if $timeout;

    And given that $pid is set by this line:

    $pid = open my $fh, "$cmd |" or die "$!, $^E";

    it can only take a numeric value or undef. If it was undef, due to the command failing to run, then the die would have prevented the code reaching the kill lines.

    So, what did you change and why?


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.