Skip to content

Commit 0d5d1fe

Browse files
committed
more error handling in the wiki examples travis script
1 parent 3e1c43e commit 0d5d1fe

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

travis-ci/check-wiki-examples.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,22 @@ def compile_and_check(examples):
4848

4949
# executing commands from cmd
5050
os.chdir(t)
51-
with open(os.path.join(t, 'output.log'), 'w') as f:
51+
logfile = os.path.join(t, 'output.log')
52+
with open(logfile, 'w') as f:
5253
for cmd in example['cmd']:
5354
cmd = cmd[2:].strip()
5455
print('--', 'calling', cmd)
5556
subprocess.call(cmd.split(' '), stderr=subprocess.STDOUT, stdout=f)
5657

5758
# comparing with out
58-
with open(os.path.join(t, 'output.log'), 'r') as f:
59+
with open(logfile, 'r') as f:
5960
for i, line in enumerate(f.readlines()):
6061
if example['out'][i] != line:
6162
print('--', 'error')
6263
errcnt += 1
63-
64+
except:
65+
print('--', 'error')
66+
with open(logfile, 'r') as fin: print fin.read()
6467
finally:
6568
os.chdir(path)
6669
shutil.rmtree(t)

0 commit comments

Comments
 (0)