Skip to content

Commit

Permalink
chore: add register_signal option to ScenarioExecution for thread (#212)
Browse files Browse the repository at this point in the history
Co-authored-by: pipinet <[email protected]>
  • Loading branch information
pipinet and pipinet authored Nov 14, 2024
1 parent acec266 commit 503634f
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,15 @@ def __init__(self,
setup_timeout=py_trees.common.Duration.INFINITE,
tick_period: float = 0.1,
scenario_parameter_file=None,
logger=None) -> None:
logger=None,
register_signal=True) -> None:

def signal_handler(sig, frame):
self.on_scenario_shutdown(False, "Aborted")

signal.signal(signal.SIGHUP, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)
if register_signal:
signal.signal(signal.SIGHUP, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)

self.current_scenario_start = None
self.current_scenario = None
Expand Down

0 comments on commit 503634f

Please sign in to comment.