Skip to content

Commit

Permalink
Also handle SIGTERM gracefully (#2747)
Browse files Browse the repository at this point in the history
Signed-off-by: Erling Rennemo Jellum
Signed-off-by: erlingrj <[email protected]>
Signed-off-by: erling <[email protected]>
Co-authored-by: Addisu Z. Taddese <[email protected]>
Co-authored-by: Ian Chen <[email protected]>
(cherry picked from commit 13bf5be)
  • Loading branch information
erlingrj authored and azeey committed Feb 4, 2025
1 parent 78954a5 commit d6b107b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/cmd/cmdsim.rb.in
Original file line number Diff line number Diff line change
Expand Up @@ -564,9 +564,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

0 comments on commit d6b107b

Please sign in to comment.