diff mercurial/util.py @ 18759:9baf4330d88f

sshpeer: store subprocess so it cleans up correctly When running 'hg pull --rebase', I was seeing this exception 100% of the time as the python process was closing down: Exception TypeError: TypeError("'NoneType' object is not callable",) in <bound method Popen.__del__ of <subprocess.Popen object at 0x937c10>> ignored By storing the subprocess on the sshpeer, the subprocess seems to clean up correctly, and I no longer see the exception. I have no idea why this actually works, but I get a 0% repro if I store the subprocess in self.subprocess, and a 100% repro if I store None in self.subprocess. Possibly related to issue 2240.
author Durham Goode <durham@fb.com>
date Fri, 08 Mar 2013 16:59:36 -0800
parents af9ddea2cb99
children 5b05ceb24a8d
line wrap: on
line diff
--- a/mercurial/util.py	Thu Feb 28 10:12:26 2013 -0800
+++ b/mercurial/util.py	Fri Mar 08 16:59:36 2013 -0800
@@ -129,13 +129,17 @@
     return p.stdin, p.stdout
 
 def popen3(cmd, env=None, newlines=False):
+    stdin, stdout, stderr, p = popen4(cmd, env, newlines)
+    return stdin, stdout, stderr
+
+def popen4(cmd, env=None, newlines=False):
     p = subprocess.Popen(cmd, shell=True, bufsize=-1,
                          close_fds=closefds,
                          stdin=subprocess.PIPE, stdout=subprocess.PIPE,
                          stderr=subprocess.PIPE,
                          universal_newlines=newlines,
                          env=env)
-    return p.stdin, p.stdout, p.stderr
+    return p.stdin, p.stdout, p.stderr, p
 
 def version():
     """Return version information if available."""