[ Please post using plain text -- NOT HTML. TIA ]
Ok, I'll answer just for the halibut.> C&J wrote:
>
> I have a cod as following :
perldoc -q "How do I make a system\(\) exit on control\-C"> my $stop = 0;
> sub my_sigint_catcher {
> $stop = 1;
> };
> $SIG{'INT'} = 'my_sigint_catcher';
>
> while (1) {
> ....
> system("ANOTHER PERL SCRIPT");
> ...
> last if ($stop);
> }
> exit 0;
>
> Here is my question:
> 1. The system(" ... ") has its own $SIC{'INT'} handler. Therefore,
> when I do ctrl-c during this period, the $stop never get set.
> Is that possible to catch this ctl-c during system("...")'s
> execution?
Found in /usr/lib/perl5/5.6.0/pod/perlfaq8.pod
How do I make a system() exit on control-C?
You can't. You need to imitate the system() call (see the
perlipc manpage for sample code) and then have a signal
handler for the INT signal that passes the signal on to
the subprocess. Or you can check for it:
$rc = system($cmd);
if ($rc & 127) { die "signal death" }
perldoc Curses> 2. I thought another easy to fix the problem is to use special
> combination dedicated for this, such as (F1 key, or CTRL-O).
> How can I do this? or where can I find related tutorial?
perldoc Term::ReadLine
John
--
use Perl;
program
fulfillment
Bookmarks