forked from VimPlug/jedi
* Use an explicit environment for subprocess to ensure that existing environment variables are not inherited. This ensures more reliable results, see issue #1540.
* Attempt to send SYSTEMROOT variable to Windows subprocess
This commit is contained in:
@@ -56,6 +56,7 @@ Code Contributors
|
|||||||
- Shane Steinert-Threlkeld (@shanest) <ssshanest@gmail.com>
|
- Shane Steinert-Threlkeld (@shanest) <ssshanest@gmail.com>
|
||||||
- Tim Gates (@timgates42) <tim.gates@iress.com>
|
- Tim Gates (@timgates42) <tim.gates@iress.com>
|
||||||
- Lior Goldberg (@goldberglior)
|
- Lior Goldberg (@goldberglior)
|
||||||
|
- Ryan Clary (@mrclary)
|
||||||
|
|
||||||
And a few more "anonymous" contributors.
|
And a few more "anonymous" contributors.
|
||||||
|
|
||||||
|
|||||||
@@ -181,6 +181,15 @@ class CompiledSubprocess(object):
|
|||||||
os.path.dirname(os.path.dirname(parso_path)),
|
os.path.dirname(os.path.dirname(parso_path)),
|
||||||
'.'.join(str(x) for x in sys.version_info[:3]),
|
'.'.join(str(x) for x in sys.version_info[:3]),
|
||||||
)
|
)
|
||||||
|
# Use explicit envionment to ensure reliable results (#1540)
|
||||||
|
env = {}
|
||||||
|
if os.name == 'nt':
|
||||||
|
# if SYSTEMROOT (or case variant) exists in environment,
|
||||||
|
# ensure it goes to subprocess
|
||||||
|
for k, v in os.environ.items():
|
||||||
|
if 'SYSTEMROOT' == k.upper():
|
||||||
|
env.update({k: os.environ[k]})
|
||||||
|
break # don't risk multiple entries
|
||||||
process = GeneralizedPopen(
|
process = GeneralizedPopen(
|
||||||
args,
|
args,
|
||||||
stdin=subprocess.PIPE,
|
stdin=subprocess.PIPE,
|
||||||
@@ -188,7 +197,8 @@ class CompiledSubprocess(object):
|
|||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
# Use system default buffering on Python 2 to improve performance
|
# Use system default buffering on Python 2 to improve performance
|
||||||
# (this is already the case on Python 3).
|
# (this is already the case on Python 3).
|
||||||
bufsize=-1
|
bufsize=-1,
|
||||||
|
env=env
|
||||||
)
|
)
|
||||||
self._stderr_queue = Queue()
|
self._stderr_queue = Queue()
|
||||||
self._stderr_thread = t = Thread(
|
self._stderr_thread = t = Thread(
|
||||||
|
|||||||
Reference in New Issue
Block a user