-
Notifications
You must be signed in to change notification settings - Fork 911
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
terminate underlying 'rosbag {play,record}' on SIGTERM #951
Conversation
Example process tree:
With the patch, after hitting control-C:
|
+1 |
@jwm Can you please provide a short sequence of command to reproduce the problem before / the improved behavior after the patch. |
@dirk-thomas Sure, it's pretty straightforward. Without the patch, run With the patch, |
I don't see any difference in behavior when hitting |
Ah, it's been a few weeks, I was misremebering. We were running |
Can you please share a reproducible example (SSCCE). |
|
I can reproduce that case and also that the patch fixes the problem. But currently the patch overwrites the signal handler. Instead it should make sure to also call any previously registered signal handle from within the lambda in order to not ignore previously registered signal handler. |
Force-pushed an updated patch. |
Thank you for the patch and iterating on it. |
Thanks for merging, Dirk! |
terminate underlying 'rosbag {play,record}' on SIGTERM
#189 (which is merged, but its underlying bug #114 is not closed) migrated from
os.execv()
tosubprocess.call()
to run theplay
andrecord
nodes.Unfortunately, when you send
rosbag
aSIGTERM
, such as with control-C, the parentrosbag
process exits, but leaves the child node running, playing or recording the bag.This traps
SIGTERM
and propagates the signal to the underlying node process. Then, a control-C ends the process as the user would expect.I don't have a Windows machine to test on, and it looks like I'd have to compile ROS from the source. However, the Python documentation says this approach is compatible with Windows:
https://docs.python.org/2/library/signal.html
https://docs.python.org/2/library/subprocess.html