1 Description: die if perltidy.ERR and other temporary files cannot be unlinked
2 Origin: Upstream, Cherrypicked from 20170521.
3 Author: Don Armstrong <don@debian.org>, Steve Hancock
4 diff --git a/lib/Perl/Tidy.pm b/lib/Perl/Tidy.pm
5 index 2b0df0e..edcec6d 100644
8 @@ -3692,7 +3702,10 @@ sub do_syntax_check {
10 my $msg = qx/perl $flags $quoted_stream_filename $error_redirection/;
12 - unlink $stream_filename if ($is_tmpfile);
14 + unlink $stream_filename
15 + or Perl::Tidy::Die("couldn't unlink stream $stream_filename: $!\n");
17 return $stream_filename, $msg;
20 @@ -4128,7 +4143,11 @@ sub new {
22 # remove any old error output file if we might write a new one
23 unless ( $fh_warnings || ref($warning_file) ) {
24 - if ( -e $warning_file ) { unlink($warning_file) }
25 + if ( -e $warning_file ) {
26 + unlink($warning_file)
28 + "couldn't unlink warning file $warning_file: $!\n");