Skip to content

Commit

Permalink
send-email: don't attempt to prompt if tty is closed
Browse files Browse the repository at this point in the history
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 <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jay Soffian authored and Junio C Hamano committed Apr 1, 2009
1 parent 91286ca commit 5906f54
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions git-send-email.perl
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,9 @@ sub ask {
my $default = $arg{default};
my $resp;
my $i = 0;
return defined $default ? $default : undef
unless defined $term->IN and defined fileno($term->IN) and
defined $term->OUT and defined fileno($term->OUT);
while ($i++ < 10) {
$resp = $term->readline($prompt);
if (!defined $resp) { # EOF
Expand Down

0 comments on commit 5906f54

Please sign in to comment.