Skip to content

Commit 5906f54

Browse files
jaysoffiangitster
authored andcommitted
send-email: don't attempt to prompt if tty is closed
Attempting to prompt when the tty is closed (typically when running from cron) is pointless and emits a warning. This patch causes ask() to return early, squelching the warning. Signed-off-by: Jay Soffian <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 91286ca commit 5906f54

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

git-send-email.perl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,9 @@ sub ask {
612612
my $default = $arg{default};
613613
my $resp;
614614
my $i = 0;
615+
return defined $default ? $default : undef
616+
unless defined $term->IN and defined fileno($term->IN) and
617+
defined $term->OUT and defined fileno($term->OUT);
615618
while ($i++ < 10) {
616619
$resp = $term->readline($prompt);
617620
if (!defined $resp) { # EOF

0 commit comments

Comments
 (0)