summaryrefslogtreecommitdiff
path: root/git-send-email.perl
diff options
context:
space:
mode:
authorJay Soffian <jaysoffian@gmail.com>2009-03-31 16:22:11 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-04-01 18:10:06 (GMT)
commit5906f54e474c6e8aabb0f6b955d446b509cde06e (patch)
treecf5a423e7fef09ae718a21140943d736849eb8de /git-send-email.perl
parent91286ca61af404d53d946d6c3388b24f004433d2 (diff)
downloadgit-5906f54e474c6e8aabb0f6b955d446b509cde06e.zip
git-5906f54e474c6e8aabb0f6b955d446b509cde06e.tar.gz
git-5906f54e474c6e8aabb0f6b955d446b509cde06e.tar.bz2
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 <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-send-email.perl')
-rwxr-xr-xgit-send-email.perl3
1 files changed, 3 insertions, 0 deletions
diff --git a/git-send-email.perl b/git-send-email.perl
index 5916c86..d790660 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