in reply to Re: signal trapping
in thread signal trapping

I tried it and sent the signal from another script, but it still doesn't work, no output file is being created, the signal wasn't captured. How did you make yours work? This is my original script:
#!/usr/bin/perl -w sub my_sig_int_handler { open (OUT,">info.txt"); print OUT "Woo-Hoo!\n"; close(OUT); } $SIG{INT} = \&my_sig_int_handler; print "process $$\n"; while(1){}
The calling script contains the following:
#!/usr/bin/perl -w $process = shift; kill 'INT', $process;
when I launch the second script, the orginal one quits but does not capture the interrupt in order to create the output file. Show me what you did.

Replies are listed 'Best First'.
Re3: signal trapping
by dragonchild (Archbishop) on Sep 28, 2001 at 23:25 UTC
    What platform are you on? I suspect that this is one of those platform-dependant things. Mine didn't work on Control-C, even when I cut'n'pasted your code. *shrugs*

    ------
    We are the carpenters and bricklayers of the Information Age.

    Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

      I'm on a PC using win2000 professional. What are you on?