in reply to Re: Emulating command line pipe
in thread Emulating command line pipe

Thank you, shmem. Unfortunately once run as a cgi the process is no longer killed upon a match, I'm not sure why. I think this might be an issue with apache, but I'm not certain.

Thank You,
Troy

Replies are listed 'Best First'.
Re^3: Emulating command line pipe
by shmem (Chancellor) on Aug 31, 2007 at 17:23 UTC
    AFAIK grep -m 1 exiting causes the OS to send a SIGPIPE to tac upon grep exit... hmm. Could it be that SIGPIPE is masked somewhere in mod_perl, ? is that masking propagated to the child? Is it even possible to mask a signal for a process group? Now that's something I don't know, you got me there :-)

    If that's the case - i.e. if SIGPIPE is masked - try my solution (which doesn't involve grep) and kill off tac with another signal (15 or, if it's renitent, 9 - SIGKILL).

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
      That was it, changed the signal to 9 and the script now executes in about 10 seconds. Thanks!

      Cheers,
      Troy