summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2020-05-25 08:23:58 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2020-05-25 08:23:58 (GMT)
commit60c48b447c036567d565a45c0ea6259baa713485 (patch)
treea40eba7df753ec7b922d9d1a9277e0e06e2f9183 /tools
parent1abda8dd17f86dbc3d8d3589f069da2689a72e41 (diff)
wasptool: Better reporting of out-of-memory problems when pasting
Diffstat (limited to 'tools')
-rwxr-xr-xtools/wasptool15
1 files changed, 14 insertions, 1 deletions
diff --git a/tools/wasptool b/tools/wasptool
index 2b8e1db..f9e2f05 100755
--- a/tools/wasptool
+++ b/tools/wasptool
@@ -77,7 +77,20 @@ def paste(c, f, verbose=False, chunk=None):
chunk()
c.sendline(ln)
- c.expect('=== ')
+
+ choice = c.expect(['=== ', 'FATAL: uncaught exception [0-9a-f\r]*\n'])
+ if choice == 1:
+ # Capture and display the error message, then exit
+ if not verbose:
+ print('\n~~~')
+ while choice == 1:
+ if not verbose:
+ print(c.match.group(0).rstrip(), file=sys.stderr)
+ choice = c.expect([pexpect.TIMEOUT, '.*\n'], timeout=2)
+ if not verbose:
+ print('~~~')
+ print('\nPlease reboot your device', file=sys.stderr)
+ sys.exit(16)
def print_log(logfile):
lines = logfile.getvalue().split('\n')