def wait_for_active_job(signal_to_send=None):
"""
Wait for the active job to finish, to be killed by SIGINT, or to be
suspended by ctrl-z.
"""
_clear_dead_jobs()
act = builtins.__xonsh_active_job__
if act is None:
return
job = builtins.__xonsh_all_jobs__[act]
obj = job['obj']
if job['bg']:
return
while obj.returncode is None:
try:
obj.wait(0.01)
except TimeoutExpired:
pass
except KeyboardInterrupt:
obj.kill()
if obj.poll() is not None:
builtins.__xonsh_active_job__ = None
评论列表
文章目录