Skip to content

Commit

Permalink
apply: simplify run_cmd() (#471)
Browse files Browse the repository at this point in the history
* It is safe to pass @_ to system() if @_ is empty
* This happens when running apply with the -0 option, e.g. "perl apply -0 echo 1 2 3" (echo runs 3 times with no argument)
  • Loading branch information
mknos committed Feb 29, 2024
1 parent 670aa97 commit 2958a35
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions bin/apply
Expand Up @@ -88,13 +88,7 @@ sub run_cmd {
print join(' ', 'exec', $cmd, @_), "\n";
return;
}
my $status;
if (scalar(@_) > 0) {
$status = system $cmd, @_;
}
else {
$status = system $cmd;
}
my $status = system $cmd, @_;
if ($status != 0) {
if ($status == -1) {
warn "$Program: command failed: $!\n";
Expand Down

0 comments on commit 2958a35

Please sign in to comment.