in reply to Re: Re: Signals and subprocesses using fork, and system or exec.
in thread Signals and subprocesses using fork, and system or exec.
#!/usr/bin/perl -w use strict; my $sshpid = fork(); defined($sshpid) or die "fork error: $!"; if ($sshpid) { print "Parent PID is $$\n"; # Parent $SIG{HUP} = sub { warn "Aborting ssh pid $sshpid\n"; kill 'ABRT', $sshpid; exit(1); }; wait; exit(0); } else { # Child exec '/bin/sleep 6' or die "exec error: $!"; }
I'm using an ABRT signal because that's what you used; I still don't think it's the right signal for this purpose, although I'm not sure what is if you can't use TERM.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Signals and subprocesses using fork, and system or exec.
by exussum0 (Vicar) on Aug 26, 2003 at 11:08 UTC | |
by sgifford (Prior) on Aug 26, 2003 at 17:52 UTC | |
by exussum0 (Vicar) on Aug 27, 2003 at 16:02 UTC |