6821: CLI asks forever when trying to overwrite while exporting

svn: r22540
This commit is contained in:
Paul Franklin 2013-06-20 16:33:40 +00:00
parent 87f5828ebe
commit 0be260b01d

View File

@ -8,7 +8,7 @@
# Copyright (C) 2008 Brian G. Matherly # Copyright (C) 2008 Brian G. Matherly
# Copyright (C) 2010 Jakim Friant # Copyright (C) 2010 Jakim Friant
# Copyright (C) 2012 Doug Blank # Copyright (C) 2012 Doug Blank
# Copyright (C) 2012 Paul Franklin # Copyright (C) 2012-2013 Paul Franklin
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -284,17 +284,15 @@ class ArgHandler(object):
self.__error(_("WARNING: Output file already exists!\n" self.__error(_("WARNING: Output file already exists!\n"
"WARNING: It will be overwritten:\n %s") % "WARNING: It will be overwritten:\n %s") %
fullpath) fullpath)
answer = None try:
while not answer: answer = raw_input(_('OK to overwrite? (yes/no) ') \
try:
ans = raw_input(_('OK to overwrite? (yes/no) ') \
.encode(sys.getfilesystemencoding())) .encode(sys.getfilesystemencoding()))
except EOFError: except EOFError:
print print
sys.exit(0) sys.exit(0)
if ans.upper() in ('Y', 'YES', _('YES').upper()): if answer.upper() in ('Y', 'YES', _('YES').upper()):
self.__error( _("Will overwrite the existing file: %s") self.__error(_("Will overwrite the existing file: %s")
% fullpath) % fullpath)
else: else:
sys.exit(0) sys.exit(0)