From: Jay Soffian Date: Tue, 31 Mar 2009 16:22:11 +0000 (-0400) Subject: send-email: don't attempt to prompt if tty is closed X-Git-Tag: v1.6.3-rc0~58 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=5906f54e474c6e8aabb0f6b955d446b509cde06e;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/git-send-email.perl b/git-send-email.perl index 5916c86b6..d790660bc 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -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