We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fcdfbc8 commit 4f3d7ddCopy full SHA for 4f3d7dd
protocol-serial-bridge.py
@@ -1,5 +1,6 @@
1
import argparse
2
import re
3
+import signal
4
import threading
5
import time
6
@@ -674,7 +675,15 @@ def start_cli(bridge: ProtocolSerialBridge):
674
675
print("\nCLI thread interrupted.")
676
677
678
+def handle_sigterm(sig, frame):
679
+ """SIGTERM handler."""
680
+ print("Received SIGTERM, exiting...")
681
+ if bridge is ProtocolSerialBridge:
682
+ bridge.close()
683
+
684
685
if __name__ == "__main__":
686
+ signal.signal(signal.SIGTERM, handle_sigterm)
687
# Set up command line argument parsing
688
parser = argparse.ArgumentParser(description="Linear Protocol Serial Bridge")
689
parser.add_argument("--port", help="Serial port to send data (e.g., /dev/ttyUSB0)")
0 commit comments