From c390fdd8c318c23725fae69224dd9e794fed3ff2 Mon Sep 17 00:00:00 2001 From: Steven Shamlian Date: Thu, 24 Aug 2023 10:39:31 -0400 Subject: [PATCH 1/2] Catch more signals for the _exit_handler Co-authored-by: Franco Vallejos Vigier <29439055+FrancoVigier@users.noreply.github.com> --- irobot_edu_sdk/robot.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/irobot_edu_sdk/robot.py b/irobot_edu_sdk/robot.py index 875c644..363248a 100644 --- a/irobot_edu_sdk/robot.py +++ b/irobot_edu_sdk/robot.py @@ -1,5 +1,5 @@ # -# Licensed under 3-Clause BSD license available in the License file. Copyright (c) 2020-2022 iRobot Corporation. All rights reserved. +# Licensed under 3-Clause BSD license available in the License file. Copyright (c) 2020-2023 iRobot Corporation. All rights reserved. # try: @@ -92,7 +92,12 @@ def __init__(self, backend: Backend): self.sound_enabled = True + # Catch all signals and direct to the _exit_handler signal.signal(signal.SIGINT, _exit_handler) + signal.signal(signal.SIGTSTP, _exit_handler) + signal.signal(signal.SIGQUIT, _exit_handler) + signal.signal(signal.SIGHUP, _exit_handler) + signal.signal(signal.SIGTERM, _exit_handler) def __enter__(self): return self From ceb3d9daa2909974f1b18b3f9b1ab601209170e7 Mon Sep 17 00:00:00 2001 From: Steven Shamlian Date: Thu, 24 Aug 2023 15:20:36 -0400 Subject: [PATCH 2/2] Fix debugging print --- irobot_edu_sdk/backend/bluetooth_desktop.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/irobot_edu_sdk/backend/bluetooth_desktop.py b/irobot_edu_sdk/backend/bluetooth_desktop.py index 61e27fc..36cb1de 100644 --- a/irobot_edu_sdk/backend/bluetooth_desktop.py +++ b/irobot_edu_sdk/backend/bluetooth_desktop.py @@ -1,5 +1,5 @@ # -# Licensed under 3-Clause BSD license available in the License file. Copyright (c) 2020-2022 iRobot Corporation. All rights reserved. +# Licensed under 3-Clause BSD license available in the License file. Copyright (c) 2020-2023 iRobot Corporation. All rights reserved. # """ @@ -49,10 +49,11 @@ async def connect(self): self._address = device.address self._device = device break - print(f'Connecting to {device.name} ({device.address})') if self._device: + print(f'Connecting to {device.name} ({device.address})') self._client = BleakClient(self._device) else: + print(f'Connecting to {self._address}') self._client = BleakClient(self._address) if await self._client.connect():