Skip to content

Commit 8c2f438

Browse files
authored
mkdir: Suppress extra newline in warning messages (#995)
Strings passed to die() and warn() already had an explicit newline, so there's no need for the SIG handlers to add it.
1 parent ee9c4c0 commit 8c2f438

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

bin/mkdir

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,9 @@ use File::Basename qw(basename);
1818
use File::Spec;
1919
use Getopt::Std qw(getopts);
2020

21-
our $VERSION = '1.6';
21+
our $VERSION = '1.7';
2222
my $Program = basename($0);
2323

24-
$SIG{__WARN__} = sub { warn "$Program: @_\n" };
25-
$SIG{__DIE__} = sub { die "$Program: @_\n" };
26-
2724
my %options;
2825
getopts('m:p', \%options) or usage();
2926
usage() unless @ARGV;
@@ -32,6 +29,9 @@ use constant EX_SUCCESS => 0;
3229
use constant EX_ERROR => 1;
3330
use constant EX_USAGE => 2;
3431

32+
$SIG{__WARN__} = sub { print { *STDERR } "$Program: @_" };
33+
$SIG{__DIE__} = sub { print { *STDERR } "$Program: @_"; exit EX_ERROR };
34+
3535
sub VERSION_MESSAGE {
3636
print "$Program version $VERSION\n";
3737
exit EX_SUCCESS;

0 commit comments

Comments
 (0)