Explorar o código

gw --bt: Backtrace on KeyboardInterrupt

Keir Fraser %!s(int64=4) %!d(string=hai) anos
pai
achega
13581f2ad3
Modificáronse 2 ficheiros con 4 adicións e 0 borrados
  1. 1 0
      scripts/greaseweazle/tools/util.py
  2. 3 0
      scripts/gw.py

+ 1 - 0
scripts/greaseweazle/tools/util.py

@@ -68,6 +68,7 @@ def with_drive_selected(fn, usb, args, *_args, **_kwargs):
         usb.reset()
         usb.ser.close()
         usb.ser.open()
+        raise
     finally:
         usb.drive_motor(args.drive[1], False)
         usb.drive_deselect()

+ 3 - 0
scripts/gw.py

@@ -70,6 +70,9 @@ try:
         res = 0
 except (IndexError, AssertionError, TypeError, KeyError):
     raise
+except KeyboardInterrupt:
+    if backtrace: raise
+    res = 1
 except Exception as err:
     if backtrace: raise
     print("** FATAL ERROR:")