Hydra::Helper::Exec add an expectOkay which dies with stdout / stderr on exit
This commit is contained in:
parent
5184e895df
commit
9ae7c8bddc
|
@ -7,8 +7,28 @@ our @ISA = qw(Exporter);
|
||||||
our @EXPORT = qw(
|
our @EXPORT = qw(
|
||||||
captureStdoutStderr
|
captureStdoutStderr
|
||||||
captureStdoutStderrWithStdin
|
captureStdoutStderrWithStdin
|
||||||
|
expectOkay
|
||||||
);
|
);
|
||||||
|
|
||||||
|
sub expectOkay {
|
||||||
|
my ($timeout, @cmd) = @_;
|
||||||
|
|
||||||
|
my ($res, $stdout, $stderr) = captureStdoutStderrWithStdin($timeout, \@cmd, "");
|
||||||
|
if ($res) {
|
||||||
|
die <<MSG;
|
||||||
|
Failure executing @cmd.
|
||||||
|
|
||||||
|
STDOUT:
|
||||||
|
$stdout
|
||||||
|
|
||||||
|
STDERR:
|
||||||
|
$stderr
|
||||||
|
MSG
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
}
|
||||||
|
|
||||||
sub captureStdoutStderr {
|
sub captureStdoutStderr {
|
||||||
my ($timeout, @cmd) = @_;
|
my ($timeout, @cmd) = @_;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue