Perl: Close and delete output files when dying
This commit is contained in:
@@ -108,6 +108,12 @@ if ($opt_D) { # Output dependencies only
|
||||
open my $out, '>', $opt_o or
|
||||
die "Can't create $opt_o: $!\n";
|
||||
|
||||
$SIG{__DIE__} = sub {
|
||||
die @_ if $^S; # Ignore eval deaths
|
||||
close $out;
|
||||
unlink $opt_o;
|
||||
};
|
||||
|
||||
my $podHtml;
|
||||
my $idify;
|
||||
my $contentType =
|
||||
|
||||
@@ -126,6 +126,12 @@ my $guard = "INC_${stem}API_H";
|
||||
open my $o, '>', $outfile or
|
||||
die "makeAPIheader.pl: Can't create $outfile: $!\n";
|
||||
|
||||
$SIG{__DIE__} = sub {
|
||||
die @_ if $^S; # Ignore eval deaths
|
||||
close $o;
|
||||
unlink $outfile;
|
||||
};
|
||||
|
||||
print $o <<"__EOF__";
|
||||
/* This is a generated file, do not edit! */
|
||||
|
||||
|
||||
@@ -68,6 +68,12 @@ open my $inp, '<', $infile or
|
||||
open my $out, '>', $opt_o or
|
||||
die "podRemove.pl: Can't create $opt_o: $!\n";
|
||||
|
||||
$SIG{__DIE__} = sub {
|
||||
die @_ if $^S; # Ignore eval deaths
|
||||
close $out;
|
||||
unlink $opt_o;
|
||||
};
|
||||
|
||||
my $inPod = 0;
|
||||
while (<$inp>) {
|
||||
if (m/\A=[a-zA-Z]/) {
|
||||
|
||||
@@ -93,6 +93,12 @@ my $root = '../' x scalar @inpath;
|
||||
open my $out, '>', $opt_o or
|
||||
die "Can't create $opt_o: $!\n";
|
||||
|
||||
$SIG{__DIE__} = sub {
|
||||
die @_ if $^S; # Ignore eval deaths
|
||||
close $out;
|
||||
unlink $opt_o;
|
||||
};
|
||||
|
||||
my $podHtml = EPICS::PodHtml->new();
|
||||
|
||||
$podHtml->html_css($root . 'style.css');
|
||||
|
||||
Reference in New Issue
Block a user