in reply to Re^2: 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
... Maybe this is not the right forum for bash/sh but what's the harm in asking :)
Yes, this is not a bash forum, and all in all, bash configuration is a rather complex topic...
Anyhow, the easiest approach would probably be to add a line
trap "kill 0" EXIT
to your a.sh. This sets up an exit handler which kills the current process group.
Then run a.sh in a new process group (so you avoid killing the calling Perl script, too):
my $x=`exec perl -e "setpgrp; exec '/root/a.sh'"`;
(I'm not aware of any way to create a new process group from within the shell script itself, so I'm using Perl's setpgrp here.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: parent process stuck in read(2) on pipe opened to child process using backtick
by choroba (Cardinal) on Feb 14, 2012 at 23:13 UTC | |
by Eliya (Vicar) on Feb 15, 2012 at 00:40 UTC | |
by choroba (Cardinal) on Feb 15, 2012 at 01:10 UTC | |
by Eliya (Vicar) on Feb 15, 2012 at 02:18 UTC |