Merge "Glance skip prompting if stdin isn't a tty"

This commit is contained in:
Jenkins 2012-03-09 16:06:58 +00:00 committed by Gerrit Code Review
commit c13dbdcf5a
2 changed files with 5 additions and 0 deletions

View File

@ -28,6 +28,7 @@ Josh Kearney <josh@jk0.org>
Justin Santa Barbara <justin@fathomdb.com> Justin Santa Barbara <justin@fathomdb.com>
Justin Shepherd <jshepher@rackspace.com> Justin Shepherd <jshepher@rackspace.com>
Ken Pepple <ken.pepple@gmail.com> Ken Pepple <ken.pepple@gmail.com>
Ken Thomas <krt@yahoo-inc.com>
Kevin L. Mitchell <kevin.mitchell@rackspace.com> Kevin L. Mitchell <kevin.mitchell@rackspace.com>
Lorin Hochstein <lorin@isi.edu> Lorin Hochstein <lorin@isi.edu>
Major Hayden <major@mhtx.net> Major Hayden <major@mhtx.net>

View File

@ -1000,6 +1000,10 @@ def user_confirm(prompt, default=False):
else: else:
prompt_default = "[y/N]" prompt_default = "[y/N]"
# for bug 884116, don't issue the prompt if stdin isn't a tty
if not hasattr(sys.stdin, 'isatty') or not sys.stdin.isatty():
return default
answer = raw_input("%s %s " % (prompt, prompt_default)) answer = raw_input("%s %s " % (prompt, prompt_default))
if answer == "": if answer == "":