move inner function out of except clause
This commit is contained in:
parent
9a0d735d40
commit
65a3dc0953
1 changed files with 9 additions and 9 deletions
|
|
@ -281,6 +281,15 @@ def watch_tasks(session, tasklist, quiet=False, poll_interval=60, ki_handler=Non
|
|||
return
|
||||
if not quiet:
|
||||
print("Watching tasks (this may be safely interrupted)...")
|
||||
if ki_handler is None:
|
||||
def ki_handler(progname, tasks, quiet):
|
||||
if not quiet:
|
||||
tlist = ['%s: %s' % (t.str(), t.display_state(t.info))
|
||||
for t in tasks.values() if not t.is_done()]
|
||||
print(
|
||||
"""Tasks still running. You can continue to watch with the '%s watch-task' command.
|
||||
Running Tasks:
|
||||
%s""" % (progname, '\n'.join(tlist)))
|
||||
sys.stdout.flush()
|
||||
rv = 0
|
||||
try:
|
||||
|
|
@ -319,15 +328,6 @@ def watch_tasks(session, tasklist, quiet=False, poll_interval=60, ki_handler=Non
|
|||
except KeyboardInterrupt:
|
||||
if tasks:
|
||||
progname = os.path.basename(sys.argv[0]) or 'koji'
|
||||
if ki_handler is None:
|
||||
def ki_handler(progname, tasks, quiet):
|
||||
if not quiet:
|
||||
tlist = ['%s: %s' % (t.str(), t.display_state(t.info))
|
||||
for t in tasks.values() if not t.is_done()]
|
||||
print(
|
||||
"""Tasks still running. You can continue to watch with the '%s watch-task' command.
|
||||
Running Tasks:
|
||||
%s""" % (progname, '\n'.join(tlist)))
|
||||
ki_handler(progname, tasks, quiet)
|
||||
raise
|
||||
return rv
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue