Signed-off-by: Michael Witten <mfwitten@xxxxxxxxx> --- git-send-email.perl | 21 ++++++++++++++------- 1 files changed, 14 insertions(+), 7 deletions(-) diff --git a/git-send-email.perl b/git-send-email.perl index 559e17b..3a140cd 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -967,15 +967,22 @@ X-Mailer: git-send-email $gitversion } if ($dry_run) { + # We don't want to send the email. + } elsif ($smtp_server_is_a_command) { - my $pid = open my $sm, '|-'; - defined $pid or die $!; - if (!$pid) { - exec($smtp_server, @sendmail_parameters) or die $!; - } - print $sm "$header\n$message"; - close $sm or die $?; + + defined (my $pid = open my $pipe, '|-') + or die "Could not fork to run '$smtp_server': $!\n"; + + $pid or exec($smtp_server, @sendmail_parameters) + or die "Could not run '$smtp_server': $!\n"; + + local $SIG{PIPE} = 'IGNORE'; + + print $pipe "$header\n$message"; + close $pipe or die "'$smtp_server' exited with status $?: $!\n"; + } else { if (!defined $smtp_server) { -- 1.6.2.2.479.g2aec -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html