hgbook
changeset 75:2bfa2499e971
Make run-example print better error messages when things go wrong.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Wed Aug 30 00:11:17 2006 -0700 (2006-08-30) |
parents | ec1f144968de |
children | df88df78288d |
files | en/examples/run-example |
line diff
1.1 --- a/en/examples/run-example Wed Aug 30 00:02:02 2006 -0700 1.2 +++ b/en/examples/run-example Wed Aug 30 00:11:17 2006 -0700 1.3 @@ -9,7 +9,6 @@ 1.4 import os 1.5 import pty 1.6 import re 1.7 -import select 1.8 import shutil 1.9 import signal 1.10 import stat 1.11 @@ -169,7 +168,17 @@ 1.12 errs = 0 1.13 if args: 1.14 for a in args: 1.15 - if example(a).run(): 1.16 + try: 1.17 + st = os.lstat(a) 1.18 + except OSError, err: 1.19 + print >> sys.stderr, '%s: %s' % (a, err.strerror) 1.20 + errs += 1 1.21 + continue 1.22 + if stat.S_ISREG(st.st_mode) and st.st_mode & 0111: 1.23 + if example(a).run(): 1.24 + errs += 1 1.25 + else: 1.26 + print >> sys.stderr, '%s: not a file, or not executable' % a 1.27 errs += 1 1.28 return errs 1.29 for name in os.listdir(path):