changeset 13014:d1c52354b0a9 stable

subrepo: use subprocess directly to avoid python 2.6 bug Using svn subrepos on MacOSX with native python 2.6.1 results in a lot of unexpected output caused by: http://bugs.python.org/issue5099 subprocess.Popen.__del__ causes AttributeError (os module == None) Avoiding dangling Popen instance solves the issue.
author Patrick Mezard <pmezard@gmail.com>
date Wed, 17 Nov 2010 21:24:36 +0100
parents 92b0d669637f
children 82ca0c43bc44
files mercurial/subrepo.py
diffstat 1 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/subrepo.py	Wed Nov 17 21:00:47 2010 +0100
+++ b/mercurial/subrepo.py	Wed Nov 17 21:24:36 2010 +0100
@@ -6,7 +6,7 @@
 # GNU General Public License version 2 or any later version.
 
 import errno, os, re, xml.dom.minidom, shutil, urlparse, posixpath
-import stat
+import stat, subprocess
 from i18n import _
 import config, util, node, error, cmdutil
 hg = None
@@ -481,12 +481,15 @@
         env = dict(os.environ)
         # Avoid localized output, preserve current locale for everything else.
         env['LC_MESSAGES'] = 'C'
-        write, read, err = util.popen3(cmd, env=env, newlines=True)
-        retdata = read.read()
-        err = err.read().strip()
-        if err:
-            raise util.Abort(err)
-        return retdata
+        p = subprocess.Popen(cmd, shell=True, bufsize=-1,
+                             close_fds=util.closefds,
+                             stdout=subprocess.PIPE, stderr=subprocess.PIPE,
+                             universal_newlines=True, env=env)
+        stdout, stderr = p.communicate()
+        stderr = stderr.strip()
+        if stderr:
+            raise util.Abort(stderr)
+        return stdout
 
     def _wcrev(self):
         output = self._svncommand(['info', '--xml'])