Skip to content

Commit

Permalink
add default SIG{TERM,INT,QUIT,HUP} handler to close more gracefully
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Oct 2, 2024
1 parent eefb204 commit 2b59fc7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
- add default SIG{TERM,INT,QUIT,HUP} handler to close more gracefully

2.030 2024-09-29
- require PDL version that has raster2fits; previously didn't require one with t_raster2fits which test used

Expand Down
10 changes: 4 additions & 6 deletions lib/PDL/Graphics/Gnuplot.pm
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
# each option. Since this mechanism is near at hand, we use it even
# for routines (such as read_polygon) that could and would use
# PDL::Options in other circumstances.
#

=encoding UTF-8
Expand Down Expand Up @@ -2076,6 +2075,8 @@ our @EXPORT_OK = qw(
);
our @EXPORT = qw(gpwin gplot greplot greset grestart);

$SIG{TERM} = $SIG{INT} = $SIG{QUIT} = $SIG{HUP} = sub { die; };

# when testing plots with binary i/o, this is the unit of test data
my $testdataunit_binary = "........"; # 8 bytes - length of an IEEE double

Expand Down Expand Up @@ -2392,13 +2393,13 @@ FOO

# Default the 'persist' option to 0, so that interactive windows behave nicely unless
# asked to stay.
if(exists($termTab->{$terminal}->{opt}->[0]->{persist}) and
if (exists($termTab->{$terminal}{opt}[0]{persist}) and
!defined($termOptions->{persist}) ) {
$termOptions->{persist} = 0;
}

# Default the 'dashed' option to 1.
if(exists($termTab->{$terminal}->{opt}->[0]->{dashed}) and
if (exists($termTab->{$terminal}{opt}[0]{dashed}) and
!defined($termOptions->{dashed}) ) {
$termOptions->{dashed} = 1;
}
Expand Down Expand Up @@ -2454,7 +2455,6 @@ sub DESTROY
_killGnuplot($this);
}


=pod
=head2 close
Expand Down Expand Up @@ -7305,10 +7305,8 @@ sub _killGnuplot {

$z = waitpid($goner, 0);
alarm(0);

}


unless($z == $goner) {
# If for some reason it didn't die, fire and forget.
kill 'KILL', $goner;
Expand Down

0 comments on commit 2b59fc7

Please sign in to comment.