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>
This commit is contained in:
parent
b6357ad4d8
commit
2839a042be
1 changed files with 10 additions and 1 deletions
|
@ -279,8 +279,17 @@ if __name__ == '__main__':
|
||||||
console = pexpect.spawn(pynus, encoding='UTF-8')
|
console = pexpect.spawn(pynus, encoding='UTF-8')
|
||||||
if args.verbose:
|
if args.verbose:
|
||||||
console.logfile = sys.stdout
|
console.logfile = sys.stdout
|
||||||
|
else:
|
||||||
|
console.logfile = io.StringIO()
|
||||||
|
|
||||||
|
try:
|
||||||
console.expect('Connect.*\(([0-9A-F:]*)\)')
|
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)
|
||||||
|
|
||||||
macaddr = console.match.group(1)
|
macaddr = console.match.group(1)
|
||||||
console.expect('Exit console using Ctrl-X')
|
console.expect('Exit console using Ctrl-X')
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
|
Loading…
Reference in a new issue