Skip to content

Commit 4f46f75

Browse files
committed
make_resource.pl: Clean up destination file around on failure
1 parent db25beb commit 4f46f75

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

build/make_resource.pl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@
1919

2020
($outfile) = $outfile =~ /(.*)/; # Untaint
2121

22+
END {
23+
if ($? != 0) {
24+
unlink("$outfile.tmp");
25+
unlink($outfile);
26+
}
27+
}
28+
2229
(my $resdir) = $outfile =~ m#^(build/[^/]+)/#;
2330
my $packager = $resdir eq 'build/packaged_resource' ? 'make_packaged_resource.ps' : 'make_resource.ps';
2431

@@ -58,7 +65,7 @@
5865
}
5966
$neededresources =~ s/\s+$//;
6067

61-
open($fh, '>', "$outfile.tmp") || die "Failed to write $outfile";
68+
open($fh, '>', "$outfile.tmp") || die "Failed to write $outfile.tmp";
6269
print $fh $body;
6370
close $fh;
6471

@@ -111,4 +118,5 @@
111118
}
112119
}
113120

121+
$? = 0; # Mark successful completion
114122
exit 0;

0 commit comments

Comments
 (0)