diff --git a/test/recipes/02-test_errstr.t b/test/recipes/02-test_errstr.t index 396d2731761cd..61adc83e5854f 100644 --- a/test/recipes/02-test_errstr.t +++ b/test/recipes/02-test_errstr.t @@ -134,8 +134,9 @@ sub match_opensslerr_reason { my @strings = @_; my $errcode_hex = sprintf "%x", $errcode; - my $reason = - ( run(app([ qw(openssl errstr), $errcode_hex ]), capture => 1) )[0]; + my @res = run(app([ qw(openssl errstr), $errcode_hex ]), capture => 1); + return 0 unless $#res >= 0; + my $reason = $res[0]; $reason =~ s|\R$||; $reason = ( split_error($reason) )[3];