replace all system() shell invocation with safer non-shell alternative
This commit is contained in:
committed by
Jörg Thalheim
parent
19280b3466
commit
5cc6ae3ca3
@@ -24,6 +24,7 @@ use Hydra::Helper::CatalystUtils;
|
||||
use Hydra::Helper::Nix;
|
||||
use File::Temp;
|
||||
use POSIX qw(strftime);
|
||||
use IPC::Run qw(run);
|
||||
|
||||
sub supportedInputTypes {
|
||||
my ($self, $inputTypes) = @_;
|
||||
@@ -86,7 +87,7 @@ sub fetchInput {
|
||||
open(my $fh, ">", $filename) or die "Cannot open $filename for writing: $!";
|
||||
print $fh encode_json \%pulls;
|
||||
close $fh;
|
||||
system("jq -S . < $filename > $tempdir/gitlab-pulls-sorted.json");
|
||||
run(["jq", "-S", "."], '<', $filename, '>', "$tempdir/gitlab-pulls-sorted.json") or die "jq command failed: $?";
|
||||
my $storePath = addToStore("$tempdir/gitlab-pulls-sorted.json");
|
||||
my $timestamp = time;
|
||||
return { storePath => $storePath, revision => strftime "%Y%m%d%H%M%S", gmtime($timestamp) };
|
||||
|
Reference in New Issue
Block a user