Close UART gracefully on SIGINT/SIGTERM in goTool.
Go exits on Ctrl+C without running defers, leaving the serial port locked; register shutdown hooks for serve and CLI commands. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -62,6 +62,8 @@ func runTest(portOverride string, baudOverride int, args []string) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("open %s: %w", port, err)
|
||||
}
|
||||
registerShutdown(func() { _ = sp.Close() })
|
||||
enableShutdownOnInterrupt()
|
||||
defer sp.Close()
|
||||
|
||||
if !*verbose {
|
||||
|
||||
Reference in New Issue
Block a user