mhearse has asked for the wisdom of the Perl Monks concerning the following question:
I've noticed that pressing the interrupte sequence (^C) will start a new iteration throught the loop. Is it possibel to send the INT signal to the running program? This doesn't seem to work:for ($i = 0; $i <= 65535; $i++) { print "port $i\n"; system "this takes 45 seconds to timeout"; }
I think each instance of system() should result in a new PID. Could this be handled by forking, and sending the INT signal from the parent to the child? I'm just not sure where to go. Any advise is appreciated.for ($i = 0; $i <= 65535; $i++) { print "port $i\n"; system "this takes 45 seconds to timeout"; sleep 2; kill ('INT', $$); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Sending signal to running script
by gaal (Parson) on Dec 20, 2004 at 21:34 UTC | |
|
Re: Sending signal to running script
by BrowserUk (Patriarch) on Dec 20, 2004 at 22:40 UTC | |
|
Re: Sending signal to running script
by Joost (Canon) on Dec 20, 2004 at 23:05 UTC | |
|
Re: Sending signal to running script
by Random_Walk (Prior) on Dec 20, 2004 at 23:18 UTC |