Skip to content

Also handle SIGTERM gracefully #2747

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

Merged
merged 4 commits into from
Feb 1, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/cmd/cmdsim.rb.in
Original file line number Diff line number Diff line change
Expand Up @@ -554,9 +554,19 @@ See https://github.com/gazebosim/gz-sim/issues/168 for more info."
options['render_engine_gui_api_backend'])
end

Signal.trap("INT") {
# Handle SIGINT and SIGTERM signals
def handle_signal(guiPid, serverPid)
self.killProcess(guiPid, "Gazebo Sim GUI", 5.0)
self.killProcess(serverPid, "Gazebo Sim Server", 5.0)
end

Signal.trap("INT") {
handle_signal(guiPid, serverPid)
return 1
}

Signal.trap("TERM") {
handle_signal(guiPid, serverPid)
return 1
}

Expand Down