From 9ae7c8bddcf1892211a43bf13cedbe7048b5f7f2 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Wed, 9 Feb 2022 20:55:50 -0500 Subject: [PATCH] Hydra::Helper::Exec add an expectOkay which dies with stdout / stderr on exit --- src/lib/Hydra/Helper/Exec.pm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/lib/Hydra/Helper/Exec.pm b/src/lib/Hydra/Helper/Exec.pm index 3e24d60d..e4702ef7 100644 --- a/src/lib/Hydra/Helper/Exec.pm +++ b/src/lib/Hydra/Helper/Exec.pm @@ -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 <