Skip to content

Commit e4643fa

Browse files
committed
Try to catch bad command on Windows
1 parent 2de9e09 commit e4643fa

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

t/run.t

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,24 @@ subtest 'undef arg' => sub {
5151

5252
subtest 'bad command' => sub {
5353
local $ENV{PATH} = '';
54+
my $warnings;
55+
local $SIG{__WARN__} = sub {
56+
$warnings = $_[0];
57+
};
58+
5459
my $command = "foo";
5560
ok ! -x $command, "$command is not executable (good)";
5661

5762
my $message = eval { $release->run( qq|$command| ) };
5863
my $at = $@;
5964
ok defined $at, "Bad command dies";
60-
like $at, qr/Could not open command/, "Error message with bad command";
65+
66+
if( $^O eq 'MSWin32' ) {
67+
like $warnings, qr/'foo' is not recognized/, 'Saw Windows error';
68+
}
69+
else {
70+
like $at, qr/Could not open command/, "Error message with bad command";
71+
}
6172
};
6273

6374
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

0 commit comments

Comments
 (0)