summaryrefslogtreecommitdiffstats
path: root/Doc/tools
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2001-02-04 15:20:26 (GMT)
committerFred Drake <fdrake@acm.org>2001-02-04 15:20:26 (GMT)
commit4e3f2752c5af235eada6df979e35941dad4574f0 (patch)
tree8343a95064c1a3bd7e723cd09e1eed81b39302ac /Doc/tools
parentf36fb69fd2c1fd3bdd0aec41e4588fc872cc401f (diff)
downloadcpython-4e3f2752c5af235eada6df979e35941dad4574f0.zip
cpython-4e3f2752c5af235eada6df979e35941dad4574f0.tar.gz
cpython-4e3f2752c5af235eada6df979e35941dad4574f0.tar.bz2
Improve diagnostic output when an external command returns a non-zero exit
code, showing the transcript for that command. This closes SF bug #129740.
Diffstat (limited to 'Doc/tools')
-rwxr-xr-xDoc/tools/mkhowto19
1 files changed, 19 insertions, 0 deletions
diff --git a/Doc/tools/mkhowto b/Doc/tools/mkhowto
index d326a09..28f18b6 100755
--- a/Doc/tools/mkhowto
+++ b/Doc/tools/mkhowto
@@ -442,6 +442,9 @@ class Job:
self.warning(
"Session transcript and error messages are in %s."
% self.log_filename)
+ sys.stderr.write("The relevant lines from the transcript are:\n")
+ sys.stderr.write("-" * 72 + "\n")
+ sys.stderr.writelines(get_run_transcript(self.log_filename))
sys.exit(rc)
def message(self, msg):
@@ -461,7 +464,23 @@ class Job:
fp.close()
+def get_run_transcript(filename):
+ """Return lines from the transcript file for the most recent run() call."""
+ fp = open(filename)
+ lines = fp.readlines()
+ fp.close()
+ lines.reverse()
+ L = []
+ for line in lines:
+ L.append(line)
+ if line[:4] == "+++ ":
+ break
+ L.reverse()
+ return L
+
+
def safe_unlink(path):
+ """Unlink a file without raising an error if it doesn't exist."""
try:
os.unlink(path)
except os.error: