changeset 136:7b5894fffc37

Don't falsely signal success to make.
author Bryan O'Sullivan <bos@serpentine.com>
date Mon, 05 Mar 2007 20:26:23 -0800
parents 0707489b90fd
children 9d7dffe74b2c
files en/examples/run-example
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/en/examples/run-example	Mon Mar 05 20:16:36 2007 -0800
+++ b/en/examples/run-example	Mon Mar 05 20:26:23 2007 -0800
@@ -124,6 +124,14 @@
         self.status('running %s ' % basename)
         tmpdir = tempfile.mkdtemp(prefix=basename)
 
+        # remove the marker file that we tell make to use to see if
+        # this run succeeded
+        try:
+            os.unlink(self.name + '.run')
+        except OSError, err:
+            if err.errno != errno.ENOENT:
+                raise
+
         rcfile = os.path.join(tmpdir, '.hgrc')
         rcfp = open(rcfile, 'w')
         print >> rcfp, '[ui]'
@@ -200,7 +208,6 @@
                         ofp.write(tex_escape(output))
                     ps = newps
                 self.status('\n')
-                open(self.name + '.run', 'w')
             except:
                 print >> sys.stderr, '(killed)'
                 os.kill(self.pid, signal.SIGKILL)
@@ -221,6 +228,8 @@
                         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
         finally:
             shutil.rmtree(tmpdir)