浏览代码

gw --bt: Backtrace on KeyboardInterrupt

Keir Fraser 4 年之前
父节点
当前提交
13581f2ad3
共有 2 个文件被更改,包括 4 次插入0 次删除
  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:")