[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] signal handling



Hitting cmd-. while the script below is running via the
MacPerl tool in MPW prints:

  :
chug chug chug chug chug chug chug chug
chug chug chug chug chug chug chug chug
Caught a SIGINT--shutting down

Versions:  MPW 3.4.2; Big MacPerl 5.1.8r4; 68K System 7.6.2

Hitting cmd-. while it is running via the MacPerl application
interrupts the output and returns control to MacPerl's UI, but does
not print the "Caught a SIGINT--shutting down" message. I don't know
how to send a QUIT signal so I haven't been able to see that work.

    -Paul-    paul.b.patton@hbc.honeywell.com

------

#!perl

sub handler {       # 1st argument is signal name
   my $sig = shift;
   print "Caught a SIG$sig--shutting down\n";
   exit(0);
}

$SIG{INT} = 'handler';
$SIG{QUIT} = 'handler';

for ( $x = 0; $x < 10000; ++$x ) {
    print "chug ";
    print "\n" if $x % 8 == 0;
}

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch