Mercurial > public > mercurial-scm > hg-stable
comparison 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 |
comparison
equal
deleted
inserted
replaced
18758:6aca4d1c744e | 18759:9baf4330d88f |
---|---|
127 universal_newlines=newlines, | 127 universal_newlines=newlines, |
128 env=env) | 128 env=env) |
129 return p.stdin, p.stdout | 129 return p.stdin, p.stdout |
130 | 130 |
131 def popen3(cmd, env=None, newlines=False): | 131 def popen3(cmd, env=None, newlines=False): |
132 stdin, stdout, stderr, p = popen4(cmd, env, newlines) | |
133 return stdin, stdout, stderr | |
134 | |
135 def popen4(cmd, env=None, newlines=False): | |
132 p = subprocess.Popen(cmd, shell=True, bufsize=-1, | 136 p = subprocess.Popen(cmd, shell=True, bufsize=-1, |
133 close_fds=closefds, | 137 close_fds=closefds, |
134 stdin=subprocess.PIPE, stdout=subprocess.PIPE, | 138 stdin=subprocess.PIPE, stdout=subprocess.PIPE, |
135 stderr=subprocess.PIPE, | 139 stderr=subprocess.PIPE, |
136 universal_newlines=newlines, | 140 universal_newlines=newlines, |
137 env=env) | 141 env=env) |
138 return p.stdin, p.stdout, p.stderr | 142 return p.stdin, p.stdout, p.stderr, p |
139 | 143 |
140 def version(): | 144 def version(): |
141 """Return version information if available.""" | 145 """Return version information if available.""" |
142 try: | 146 try: |
143 import __version__ | 147 import __version__ |