my $Warn_count;
my $fh_stderr;
+
+# Bump Warn_count only: it is essential to bump the count on all warnings, even
+# if no message goes out, so that the correct exit status is set.
+sub Warn_count_bump { $Warn_count++; return }
+
+# Output Warn message only
+sub Warn_msg { my $msg = shift; $fh_stderr->print($msg); return }
+
+# Output Warn message and bump Warn count
sub Warn { my $msg = shift; $fh_stderr->print($msg); $Warn_count++; return }
sub perltidy {
$logger_object->interrupt_logfile();
$logger_object->warning( $diff_msg . "\n" );
$logger_object->resume_logfile();
- $Warn_count ||= 1; # insure correct exit if -q flag is set
+ ## $Warn_count ||= 1; # logger warning does this now
}
}
if ( $rOpts->{'assert-untidy'} ) {
$logger_object->warning(
"assertion failure: '--assert-untidy' is set but output equals input\n"
);
- $Warn_count ||= 1; # insure correct exit if -q flag is set
+ ## $Warn_count ||= 1; # logger warning does this now
}
}
#use constant WARNING_LIMIT => 50;
my $WARNING_LIMIT = 50;
+ # Always bump the warn count, even if no message goes out
+ Perl::Tidy::Warn_count_bump();
+
my $rOpts = $self->{_rOpts};
unless ( $rOpts->{'quiet'} ) {
( $fh_warnings, my $filename ) =
Perl::Tidy::streamhandle( $warning_file, 'w', $is_encoded_data );
$fh_warnings or Perl::Tidy::Die("couldn't open $filename $!\n");
- Perl::Tidy::Warn("## Please see file $filename\n")
+ Perl::Tidy::Warn_msg("## Please see file $filename\n")
unless ref($warning_file);
$self->{_fh_warnings} = $fh_warnings;
$fh_warnings->print("Perltidy version is $Perl::Tidy::VERSION\n");
+=head1 Issues fixed after release 20201207
+
+=over 4
+
+=item B<Fix for issue git #49, exit status not correctly set>
+
+The exit status flag was not being set for the -w option if the -se or if the -q flag
+were set. Issue git #44 was similar but a special case of the problem. The
+problem was fixed 8 Dec 2020.
+
+=back
+
=head1 Issues fixed after release 20201202
=over 4