tools/qvm-run: fix waiting for session

Register SIGCHLD signal handler later - do not stop data processing when
qubes.WaitForSession service exits.
This commit is contained in:
Marek Marczykowski-Górecki 2017-05-18 09:50:50 +02:00
parent 7f5fc6ac3d
commit 024ac6a810
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -159,13 +159,13 @@ def main(args=None, app=None):
else:
print('Running \'{}\' on {}'.format(args.cmd, vm.name),
file=sys.stderr)
if args.passio and not args.localcmd:
loop = asyncio.new_event_loop()
loop.add_signal_handler(signal.SIGCHLD, loop.stop)
if args.gui:
wait_session = vm.run_service('qubes.WaitForSession',
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
wait_session.communicate(vm.default_user.encode())
if args.passio and not args.localcmd:
loop = asyncio.new_event_loop()
loop.add_signal_handler(signal.SIGCHLD, loop.stop)
proc = vm.run_service('qubes.VMShell',
user=args.user,
localcmd=args.localcmd,