summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2020-10-10 20:06:32 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2020-10-10 20:42:51 (GMT)
commit2839a042be56d85eb93fe0b04c58bd9714ff624d (patch)
tree31c1ece78fba6b07b6464c846fc096c95eee54d8 /tools
parentb6357ad4d8b3a9cc4099e9446a2f8b5b01a2d159 (diff)
tools: wasptool: Hide the stack trace on pexpect timeout
The default pexpect exception dump is verbose and potentially useful if you know how to read it... but let's handle timeouts in a friendlier way. Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/wasptool11
1 files changed, 10 insertions, 1 deletions
diff --git a/tools/wasptool b/tools/wasptool
index 78ff83a..59f9b6f 100755
--- a/tools/wasptool
+++ b/tools/wasptool
@@ -279,8 +279,17 @@ if __name__ == '__main__':
console = pexpect.spawn(pynus, encoding='UTF-8')
if args.verbose:
console.logfile = sys.stdout
+ else:
+ console.logfile = io.StringIO()
+
+ try:
+ console.expect('Connect.*\(([0-9A-F:]*)\)')
+ except pexpect.exceptions.TIMEOUT:
+ print('ERROR: Cannot find suitable wasp-os device')
+ if not args.verbose:
+ print_log(console.logfile)
+ sys.exit(1)
- console.expect('Connect.*\(([0-9A-F:]*)\)')
macaddr = console.match.group(1)
console.expect('Exit console using Ctrl-X')
time.sleep(0.5)