in reply to Re: Window Close / Process Termination Handler on Windows
in thread Window Close / Process Termination Handler on Windows
Thanks for your feedback. Unfortunately adding BREAK to my list of signals still did not cause my code to trigger. The log is still empty after i close the window.
Updated Code which still does not trigger:The List of signals for which a signal handler is registered:# partially based upon code by BrowserUK from https://www.perlmonks.or +g/?node_id=629210 use strict; use Config; use FindBin; use File::Spec; my $log_fn = File::Spec->catfile($FindBin::Bin, "cleanup_handler_log.t +xt"); my $LOG; open $LOG, '>>', $log_fn or die "Failed to open log '$log_fn' for appe +nding ($!)\n"; binmode $LOG; $LOG->autoflush(1); # disable buffering my @sigs = split ' ', $Config{ sig_name }; shift @sigs; print "SIGNALS: @sigs\n"; for ( @sigs ) { my $msg = "Signal $_ received\n"; $SIG{ $_ } = sub{ print $LOG $msg; warn $msg; }; } my $count; while( 1 ) { $count += 1 for 1.. 1e6; warn $count; sleep 3; }
SIGNALS: HUP INT QUIT ILL NUM05 NUM06 NUM07 FPE KILL NUM10 SEGV NUM12 +PIPE ALRM TERM NUM16 NUM17 NUM18 NUM19 CHLD BREAK ABRT STOP NUM24 CONT CLD
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Window Close / Process Termination Handler on Windows
by TheloniusMonk (Sexton) on Aug 29, 2018 at 14:51 UTC | |
by rminner (Chaplain) on Aug 29, 2018 at 16:01 UTC |