in reply to Re^4: parent process stuck in read(2) on pipe opened to child process using backtick
in thread parent process stuck in read(2) on pipe opened to child process using backtick

This isn't really what I meant.   Or how would you adapt this in any elegant way so that when put in a.sh, it runs the code in the script itself under a new process group?  (The idea being that you could say my $x=`./a.sh` without creating an extra wrapper script.)

Replies are listed 'Best First'.
Re^6: parent process stuck in read(2) on pipe opened to child process using backtick
by choroba (Cardinal) on Feb 15, 2012 at 01:10 UTC
    I am not sure it would work as advertised, but I woudl try something like
    bash -i -c '(HERE GOES THE ORIGINAL CODE OF a.sh) & echo $!'
    Update: The echo would probably mess with the backticks. I should not link to a material I am not so familiar with :-)

      I don't think this would work (for several reasons).  Also, the -c '...' would result in a quoting mess with any real script code.

      I you think differently, please provide a complete modified a.sh, which, when killed, kills its subprocesses, but not the calling process.