mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-04-02 04:22:56 +00:00
Bug 1497976: Pass close_fds when running commands for configure. r=glandium
Running rustc with an open fd 4 sometimes causes it to fail with an obscure error when it tries to connect to a job server on that fd. Closing the fd solves the problem. close_fds does what we need, and is the default value in Python 3, but not in Python 2. Differential Revision: https://phabricator.services.mozilla.com/D8167 --HG-- extra : rebase_source : d94447019e3e698d7cf2c293b0a9b99769cf316a
This commit is contained in:
parent
e31a432ca5
commit
f07a2d0fb0
@ -22,6 +22,7 @@ def configure_error(message):
|
||||
|
||||
# A wrapper to obtain a process' output and return code.
|
||||
# Returns a tuple (retcode, stdout, stderr).
|
||||
@imports('os')
|
||||
@imports(_from='__builtin__', _import='unicode')
|
||||
@imports('subprocess')
|
||||
@imports(_from='mozbuild.shellutil', _import='quote')
|
||||
@ -44,7 +45,13 @@ def get_cmd_output(*args, **kwargs):
|
||||
|
||||
log.debug('Executing: `%s`', quote(*args))
|
||||
proc = subprocess.Popen(args, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE, **kwargs)
|
||||
stderr=subprocess.PIPE,
|
||||
# On Python 2 on Windows, close_fds prevents the
|
||||
# process from inheriting stdout/stderr.
|
||||
# Elsewhere, it simply prevents it from inheriting
|
||||
# extra file descriptors, which is what we want.
|
||||
close_fds=os.name != 'nt',
|
||||
**kwargs)
|
||||
stdout, stderr = proc.communicate()
|
||||
return proc.wait(), stdout, stderr
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user