##// END OF EJS Templates
setup: update runcmd() to also return the exit status...
Adam Simpkins -
r33111:87ee783f default
parent child Browse files
Show More
@@ -146,10 +146,10 b' def runcmd(cmd, env):'
146 p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
146 p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
147 stderr=subprocess.PIPE, env=env)
147 stderr=subprocess.PIPE, env=env)
148 out, err = p.communicate()
148 out, err = p.communicate()
149 return out, err
149 return p.returncode, out, err
150
150
151 def runhg(cmd, env):
151 def runhg(cmd, env):
152 out, err = runcmd(cmd, env)
152 returncode, out, err = runcmd(cmd, env)
153 # If root is executing setup.py, but the repository is owned by
153 # If root is executing setup.py, but the repository is owned by
154 # another user (as in "sudo python setup.py install") we will get
154 # another user (as in "sudo python setup.py install") we will get
155 # trust warnings since the .hg/hgrc file is untrusted. That is
155 # trust warnings since the .hg/hgrc file is untrusted. That is
@@ -159,7 +159,7 b' def runhg(cmd, env):'
159 if not e.startswith(b'not trusting file') \
159 if not e.startswith(b'not trusting file') \
160 and not e.startswith(b'warning: Not importing') \
160 and not e.startswith(b'warning: Not importing') \
161 and not e.startswith(b'obsolete feature not enabled')]
161 and not e.startswith(b'obsolete feature not enabled')]
162 if err:
162 if err or returncode != 0:
163 printf("stderr from '%s':" % (' '.join(cmd)), file=sys.stderr)
163 printf("stderr from '%s':" % (' '.join(cmd)), file=sys.stderr)
164 printf(b'\n'.join([b' ' + e for e in err]), file=sys.stderr)
164 printf(b'\n'.join([b' ' + e for e in err]), file=sys.stderr)
165 return ''
165 return ''
@@ -404,8 +404,8 b' class buildhgextindex(Command):'
404 # here no extension enabled, disabled() lists up everything
404 # here no extension enabled, disabled() lists up everything
405 code = ('import pprint; from mercurial import extensions; '
405 code = ('import pprint; from mercurial import extensions; '
406 'pprint.pprint(extensions.disabled())')
406 'pprint.pprint(extensions.disabled())')
407 out, err = runcmd([sys.executable, '-c', code], env)
407 returncode, out, err = runcmd([sys.executable, '-c', code], env)
408 if err:
408 if err or returncode != 0:
409 raise DistutilsExecError(err)
409 raise DistutilsExecError(err)
410
410
411 with open(self._indexfilename, 'w') as f:
411 with open(self._indexfilename, 'w') as f:
General Comments 0
You need to be logged in to leave comments. Login now