git.shiar.nl
/
barcat.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
31f7d50
)
IPC::Run to run example commands
author
Mischa POSLAWSKY
<perl@shiar.org>
Fri, 19 Mar 2021 02:36:43 +0000
(
03:36
+0100)
committer
Mischa POSLAWSKY
<perl@shiar.org>
Mon, 18 Apr 2022 09:04:29 +0000
(11:04 +0200)
t/examples.t
patch
|
blob
|
history
diff --git
a/t/examples.t
b/t/examples.t
index ae3e7c9c8721d9a7ab43375c0f3159e48c138fa2..52e7a5a7b732f06bec7a4037617d8eb36afa1e7d 100755
(executable)
--- a/
t/examples.t
+++ b/
t/examples.t
@@
-2,6
+2,7
@@
use 5.014;
use warnings;
use re '/ms';
use 5.014;
use warnings;
use re '/ms';
+use IPC::Run 'run';
use Test::More;
{ # silence fail diagnostics because of single caller
use Test::More;
{ # silence fail diagnostics because of single caller
@@
-47,15
+48,15
@@
while (readline $input) {
$subcmd .= " \\K", $args .= ' ' unless $subcmd =~ m/\\K/;
$cmd =~ s/\b$subcmd/$args/;
}
$subcmd .= " \\K", $args .= ' ' unless $subcmd =~ m/\\K/;
$cmd =~ s/\b$subcmd/$args/;
}
-
$cmd =~ s/'/'\\''/g, $cmd = " bash -c 'set -o pipefail\n$cmd'"
;
+
my @cmd = (bash => -c => "set -o pipefail\n$cmd")
;
# run and report unexpected results
ok(eval {
# run and report unexpected results
ok(eval {
-
my $output = qx($cmd
);
+
run(\@cmd, \undef, \my $output
);
$? == 0 or die "error status ", $? >> 8, "\n";
length $output or die "empty output\n";
return 1;
$? == 0 or die "error status ", $? >> 8, "\n";
length $output or die "empty output\n";
return 1;
- }, $name) or diag("Failed command\n
$
cmd\nfrom $filename line $.: $@");
+ }, $name) or diag("Failed command\n
@
cmd\nfrom $filename line $.: $@");
}
done_testing();
}
done_testing();