Hoernchen submitted this change.

View Change



2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.

Approvals: dexter: Looks good to me, approved laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified
tools: print tracebacks to the same stream as delimiters

Error output is currently a garbled mess, delimiters are printed with
poutput() or print(), traceback with traceback.print_exc() which goes
to stderr.

Reading stdout alone omits the report but not -->8-- lines.
Reading both streams makes the traceback appear where the two buffers
just happen to interleave, stderr is usually unbuffered but stdout is
not, so I get the error trace, APDU trace, then empty -->8-- lines.

Fix this by aligning the printing funcs.

Change-Id: I2ed37dfe241d014e4a26894cddbc9b21be1fd0c2
---
M pySim-prog.py
M pySim-shell.py
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/pySim-prog.py b/pySim-prog.py
index 6111fc1..0a3e888 100755
--- a/pySim-prog.py
+++ b/pySim-prog.py
@@ -816,7 +816,7 @@
print("")
print("Card programming failed with an exception:")
print("---------------------8<---------------------")
- traceback.print_exc()
+ print(traceback.format_exc().rstrip())
print("---------------------8<---------------------")
print("")
rc = -1
diff --git a/pySim-shell.py b/pySim-shell.py
index 2d9d356..3a0dedd 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -351,7 +351,7 @@
self.poutput("")
self.poutput("Card initialization (%s) failed with an exception:" % str(self.sl))
self.poutput("---------------------8<---------------------")
- traceback.print_exc()
+ self.poutput(traceback.format_exc().rstrip())
self.poutput("---------------------8<---------------------")
self.poutput("")
return -1
@@ -465,7 +465,7 @@
self.poutput("")
self.poutput("Card handling (%s) failed with an exception:" % str(self.sl))
self.poutput("---------------------8<---------------------")
- traceback.print_exc()
+ self.poutput(traceback.format_exc().rstrip())
self.poutput("---------------------8<---------------------")
self.poutput("")
fail_count = fail_count + 1
@@ -1176,7 +1176,7 @@
startup_errors = True
print("Card initialization (%s) failed with an exception:" % str(sl))
print("---------------------8<---------------------")
- traceback.print_exc()
+ print(traceback.format_exc().rstrip())
print("---------------------8<---------------------")
if not opts.noprompt:
print("(you may still try to recover from this manually by using the 'equip' command.)")

To view, visit change 43555. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I2ed37dfe241d014e4a26894cddbc9b21be1fd0c2
Gerrit-Change-Number: 43555
Gerrit-PatchSet: 3
Gerrit-Owner: Hoernchen <ewild@sysmocom.de>
Gerrit-Reviewer: Hoernchen <ewild@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier@sysmocom.de>
Gerrit-Reviewer: laforge <laforge@osmocom.org>