From fdf6f4d3dad0967238b40621186826457224de5b Mon Sep 17 00:00:00 2001 From: Cole Helbling Date: Tue, 25 Jan 2022 12:09:05 -0800 Subject: [PATCH] RunCommand: use IPC::Run3::run3 instead run3 just seems to do better handling for what we want to do, and requires less deep-reaching changes to this plugin to get it to play nice, as IPC::Run::run would. --- flake.nix | 1 + src/lib/Hydra/Plugin/RunCommand.pm | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index 3e382d9f..3b69d0bb 100644 --- a/flake.nix +++ b/flake.nix @@ -474,6 +474,7 @@ git IOCompress IPCRun + IPCRun3 JSON JSONMaybeXS JSONXS diff --git a/src/lib/Hydra/Plugin/RunCommand.pm b/src/lib/Hydra/Plugin/RunCommand.pm index eea4d2e1..d1ce8f55 100644 --- a/src/lib/Hydra/Plugin/RunCommand.pm +++ b/src/lib/Hydra/Plugin/RunCommand.pm @@ -10,7 +10,7 @@ use Hydra::Model::DB; use Hydra::Helper::Nix; use File::Basename qw(dirname); use File::Path qw(make_path); -use IPC::Run; +use IPC::Run3; sub isEnabled { my ($self) = @_; @@ -178,9 +178,7 @@ sub buildFinished { open(my $f, '>', $logPath); umask($oldUmask); - my $stdin = ""; - my @cmd = ["sh", "-c", $command]; - IPC::Run::run(@cmd, \$stdin, $f, '2>&1') == 1 + run3($command, \undef, $f, $f, { return_if_system_error => 1 }) == 1 or warn "notification command '$command' failed with exit status $? ($!)\n"; close($f);