captureStdoutStderr*: move to Hydra::Helper::Exec which helps avoid some environment variable fixation problems
This commit is contained in:
@ -18,8 +18,6 @@ use UUID4::Tiny qw(is_uuid4_string);
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(
|
||||
cancelBuilds
|
||||
captureStdoutStderr
|
||||
captureStdoutStderrWithStdin
|
||||
constructRunCommandLogPath
|
||||
findLog
|
||||
gcRootFor
|
||||
@ -429,30 +427,7 @@ sub pathIsInsidePrefix {
|
||||
}
|
||||
|
||||
|
||||
sub captureStdoutStderr {
|
||||
my ($timeout, @cmd) = @_;
|
||||
|
||||
return captureStdoutStderrWithStdin($timeout, \@cmd, "");
|
||||
}
|
||||
|
||||
sub captureStdoutStderrWithStdin {
|
||||
my ($timeout, $cmd, $stdin) = @_;
|
||||
my $stdout;
|
||||
my $stderr;
|
||||
|
||||
eval {
|
||||
local $SIG{ALRM} = sub { die "timeout\n" }; # NB: \n required
|
||||
alarm $timeout;
|
||||
IPC::Run::run($cmd, \$stdin, \$stdout, \$stderr);
|
||||
alarm 0;
|
||||
1;
|
||||
} or do {
|
||||
die unless $@ eq "timeout\n"; # propagate unexpected errors
|
||||
return (-1, $stdout, ($stderr // "") . "timeout\n");
|
||||
};
|
||||
|
||||
return ($?, $stdout, $stderr);
|
||||
}
|
||||
|
||||
|
||||
sub run {
|
||||
|
Reference in New Issue
Block a user