From: Don Armstrong Date: Tue, 19 Jun 2007 14:29:36 +0000 (-0700) Subject: * Only block SIGINT when it's important to; stop as soon as possible X-Git-Tag: release/2.6.0~545^2 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=eac301e769dcf7d6fa554f257fcf6dd6e4b742e5;p=debbugs.git * Only block SIGINT when it's important to; stop as soon as possible * Fix left shifted parenthesis in lockpid --- diff --git a/Debbugs/Common.pm b/Debbugs/Common.pm index 4f36cb1c..4ef98f62 100644 --- a/Debbugs/Common.pm +++ b/Debbugs/Common.pm @@ -367,7 +367,7 @@ sub lockpid { unlink $pidfile or die "Unable to unlink stale pidfile $pidfile $!"; } - my $pidfh = IO::File->new($pidfile), 'w' or + my $pidfh = IO::File->new($pidfile,'w') or die "Unable to open $pidfile for writing: $!"; print {$pidfh} $$ or die "Unable to write to $pidfile $!"; close $pidfh or die "Unable to close $pidfile $!"; diff --git a/scripts/expire.in b/scripts/expire.in index 926a14da..1b27dcee 100755 --- a/scripts/expire.in +++ b/scripts/expire.in @@ -90,7 +90,6 @@ foreach my $dir (@dirs) { my $bug; my $errors=0; our $exit_now = 0; -$SIG{INT} = sub {$exit_now=1;}; #process each bug (ie, status file) my @bugs_to_archive = (); for my $bug (@list) { @@ -100,14 +99,17 @@ for my $bug (@list) { push @bugs_to_archive,$bug; } +$SIG{INT} = sub {$exit_now=1;}; # At this point we want to block control if (not lockpid($config{spool_dir}.'/lock/expire.pid')) { exit 1; } # We'll also double check that the bug can be archived for my $bug (@bugs_to_archive) { + last if $exit_now; print "Reexamining $bug\n" if $verbose; next unless bug_archiveable(bug=>$bug); + last if $exit_now; print "Bug $bug can be archived: " if $verbose; eval { bug_archive(bug=>$bug,