Skip to content

Commit

Permalink
Merge pull request #48 from ros2/ensure_termination_on_keyboardint
Browse files Browse the repository at this point in the history
ensure terminating subprocesses on keyboard interrupt
  • Loading branch information
dirk-thomas authored Dec 21, 2016
2 parents 2131557 + 4e8f513 commit 3b990bc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion launch/launch/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,17 @@ def launch(self):
asyncio.set_event_loop(self.loop)
loop = self.loop
try:
returncode = loop.run_until_complete(self._run())
generator = self._run()
returncode = loop.run_until_complete(generator)
except _TaskException as e:
print(
'Failed to execute command: ' +
' '.join(self.task_descriptors[e.task_descriptor_index].cmd), file=sys.stderr)
raise e.exception
except KeyboardInterrupt:
self.interrupt_launch_non_threadsafe()
loop.run_forever()
returncode = 1
loop.close()
with self.loop_lock:
self.loop = None
Expand Down

0 comments on commit 3b990bc

Please sign in to comment.