changeset 160:745ff473c8c4

Catch more errors.
author Bryan O'Sullivan <bos@serpentine.com>
date Mon, 26 Mar 2007 21:25:34 -0700
parents 7355af913937
children 7f07aca44938
files en/examples/run-example
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/en/examples/run-example	Thu Mar 22 23:03:11 2007 -0700
+++ b/en/examples/run-example	Mon Mar 26 21:25:34 2007 -0700
@@ -211,7 +211,7 @@
                             assert os.sep not in out
                             if ofp is not None:
                                 ofp.close()
-                                err = self.rename_output(ofp_basename, ignore)
+                                err |= self.rename_output(ofp_basename, ignore)
                             if out:
                                 ofp_basename = '%s.%s' % (self.name, out)
                                 ofp = open(ofp_basename + '.tmp', 'w')
@@ -247,20 +247,21 @@
                     if ofp is not None:
                         ofp.write(output)
                         ofp.close()
-                        err = self.rename_output(ofp_basename, ignore)
+                        err |= self.rename_output(ofp_basename, ignore)
                     os.close(self.cfd)
                 except IOError:
                     pass
                 os.kill(self.pid, signal.SIGTERM)
                 pid, rc = os.wait()
-                if rc:
+                err = err or rc
+                if err:
                     if os.WIFEXITED(rc):
                         print >> sys.stderr, '(exit %s)' % os.WEXITSTATUS(rc)
                     elif os.WIFSIGNALED(rc):
                         print >> sys.stderr, '(signal %s)' % os.WTERMSIG(rc)
                 else:
                     open(self.name + '.run', 'w')
-                return rc or err
+                return err
         finally:
             shutil.rmtree(tmpdir)
 
@@ -292,9 +293,10 @@
             if err.errno != errno.ENOENT:
                 raise
             os.rename(errname, oldname)
-            return
+            return False
         if matchfp(oldfp, errfp):
             os.unlink(errname)
+            return False
         else:
             print >> sys.stderr, '\nOutput of %s has changed!' % base
             os.system('diff -u %s %s 1>&2' % (oldname, errname))