Don't prompt for the IMAP password if in quiet mode or if not running

interactively (stdin is not a terminal).
This commit is contained in:
Nikolaus Schulz 2006-11-01 20:57:58 +00:00
parent 89e6683334
commit 3d8a1bda89
1 changed files with 2 additions and 0 deletions

View File

@ -1310,6 +1310,8 @@ def _archive_imap(mailbox_name, final_archive_name):
try:
imap_username, imap_password = imap_username.split(':', 1)
except ValueError:
if (not os.isatty(sys.stdin.fileno())) or options.quiet:
unexpected_error("No imap password specified")
imap_password = getpass.getpass()
if mailbox_name[:5] == 'imaps':