Your Mother has asked for the wisdom of the Perl Monks concerning the following question:
I recently gave some advice about negating the PID of process to kill its children: Re: open (to read) and kill a pipe to a pipe. According to the perldoc for kill, I was wrong. And the OP in that thread reported that doing it the way I suggested didn't work but trying per the doc did work, on Windows no less. But the "wrong" way seems to work on *nix too. Anyone know why?
(Updated title to include "kill.")system("sleep 1234 &"); my ( $pid ) = qx{ pgrep -f sleep | xargs ps | grep "1234" | grep -v grep } =~ /(\d+)/; print "Check me\n\tps $pid\n"; # kill 9 => $$; # Leaves sleep process alive. # kill -9 => $$; # Kills sleep process. kill 9 => -$$; # Also kills sleep process.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Kill negated PIDs v negated SIGs
by psini (Deacon) on Aug 27, 2010 at 19:15 UTC | |
|
Re: Kill negated PIDs v negated SIGs
by ikegami (Patriarch) on Aug 27, 2010 at 23:12 UTC | |
by BrowserUk (Patriarch) on Aug 27, 2010 at 23:57 UTC |