hgbook
diff en/examples/run-example @ 163:a342a44e5e66
Deal with new hg command output.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Mon Mar 26 22:27:03 2007 -0700 (2007-03-26) |
parents | 914babdc99c8 |
children | 8f4c9ae918af |
line diff
1.1 --- a/en/examples/run-example Mon Mar 12 23:10:32 2007 -0700 1.2 +++ b/en/examples/run-example Mon Mar 26 22:27:03 2007 -0700 1.3 @@ -211,7 +211,7 @@ 1.4 assert os.sep not in out 1.5 if ofp is not None: 1.6 ofp.close() 1.7 - err = self.rename_output(ofp_basename, ignore) 1.8 + err |= self.rename_output(ofp_basename, ignore) 1.9 if out: 1.10 ofp_basename = '%s.%s' % (self.name, out) 1.11 ofp = open(ofp_basename + '.tmp', 'w') 1.12 @@ -247,20 +247,21 @@ 1.13 if ofp is not None: 1.14 ofp.write(output) 1.15 ofp.close() 1.16 - err = self.rename_output(ofp_basename, ignore) 1.17 + err |= self.rename_output(ofp_basename, ignore) 1.18 os.close(self.cfd) 1.19 except IOError: 1.20 pass 1.21 os.kill(self.pid, signal.SIGTERM) 1.22 pid, rc = os.wait() 1.23 - if rc: 1.24 + err = err or rc 1.25 + if err: 1.26 if os.WIFEXITED(rc): 1.27 print >> sys.stderr, '(exit %s)' % os.WEXITSTATUS(rc) 1.28 elif os.WIFSIGNALED(rc): 1.29 print >> sys.stderr, '(signal %s)' % os.WTERMSIG(rc) 1.30 else: 1.31 open(self.name + '.run', 'w') 1.32 - return rc or err 1.33 + return err 1.34 finally: 1.35 shutil.rmtree(tmpdir) 1.36 1.37 @@ -292,9 +293,10 @@ 1.38 if err.errno != errno.ENOENT: 1.39 raise 1.40 os.rename(errname, oldname) 1.41 - return 1.42 + return False 1.43 if matchfp(oldfp, errfp): 1.44 os.unlink(errname) 1.45 + return False 1.46 else: 1.47 print >> sys.stderr, '\nOutput of %s has changed!' % base 1.48 os.system('diff -u %s %s 1>&2' % (oldname, errname))