Hydra::Helper::Exec add an expectOkay which dies with stdout / stderr on exit

This commit is contained in:
Graham Christensen 2022-02-09 20:55:50 -05:00
parent 5184e895df
commit 9ae7c8bddc

View file

@ -7,8 +7,28 @@ our @ISA = qw(Exporter);
our @EXPORT = qw(
captureStdoutStderr
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 {
my ($timeout, @cmd) = @_;