Skip to content

Commit a47eab0

Browse files
artagnongitster
authored andcommitted
send-email: use the three-arg form of open in recipients_cmd
Perlcritic does not want to see the trailing pipe in the two-args form of open(), i.e. open my $fh, "$cmd \Q$file\E |"; If $cmd were a single-token command name, it would make a lot more sense to use four-or-more-args form "open FILEHANDLE,MODE,CMD,ARGS" to avoid shell from expanding metacharacters in $file, but we do expect multi-word string in $to_cmd and $cc_cmd to be expanded by the shell, so we cannot rewrite it to open my $fh, "-|", $cmd, $file; for extra safety. At least, by using this in the three-arg form: open my $fh, "-|", "$cmd \Q$file\E"; we can silence Perlcritic, even though we do not gain much safety by doing so. Signed-off-by: Ramkumar Ramachandra <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9b39703 commit a47eab0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

git-send-email.perl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1440,7 +1440,7 @@ sub recipients_cmd {
14401440

14411441
my $sanitized_sender = sanitize_address($sender);
14421442
my @addresses = ();
1443-
open my $fh, "$cmd \Q$file\E |"
1443+
open my $fh, "-|", "$cmd \Q$file\E"
14441444
or die "($prefix) Could not execute '$cmd'";
14451445
while (my $address = <$fh>) {
14461446
$address =~ s/^\s*//g;

0 commit comments

Comments
 (0)