diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2017-01-12 10:53:20 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2017-01-12 10:53:20 (GMT) |
commit | 798ad2742b6523250e5477557e3cc2588d6e6475 (patch) | |
tree | b7a9868ed00acb4d0696f3bcd267ee65d00accb5 /Lib/test/support/script_helper.py | |
parent | 89483ba1355ee170513fae6b2bb909e8f9238080 (diff) | |
parent | 12c4aba1a0fbd934a66d6b97c29c36d7de14e755 (diff) | |
download | cpython-798ad2742b6523250e5477557e3cc2588d6e6475.zip cpython-798ad2742b6523250e5477557e3cc2588d6e6475.tar.gz cpython-798ad2742b6523250e5477557e3cc2588d6e6475.tar.bz2 |
Merge 3.6
Diffstat (limited to 'Lib/test/support/script_helper.py')
-rw-r--r-- | Lib/test/support/script_helper.py | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/Lib/test/support/script_helper.py b/Lib/test/support/script_helper.py index 2627a1e..1e74647 100644 --- a/Lib/test/support/script_helper.py +++ b/Lib/test/support/script_helper.py @@ -67,17 +67,28 @@ def run_python_until_end(*args, **env_vars): elif not env_vars and not env_required: # ignore Python environment variables cmd_line.append('-E') - # Need to preserve the original environment, for in-place testing of - # shared library builds. - env = os.environ.copy() - # set TERM='' unless the TERM environment variable is passed explicitly - # see issues #11390 and #18300 - if 'TERM' not in env_vars: - env['TERM'] = '' + # But a special flag that can be set to override -- in this case, the # caller is responsible to pass the full environment. if env_vars.pop('__cleanenv', None): env = {} + if sys.platform == 'win32': + # Windows requires at least the SYSTEMROOT environment variable to + # start Python. + env['SYSTEMROOT'] = os.environ['SYSTEMROOT'] + + # Other interesting environment variables, not copied currently: + # COMSPEC, HOME, PATH, TEMP, TMPDIR, TMP. + else: + # Need to preserve the original environment, for in-place testing of + # shared library builds. + env = os.environ.copy() + + # set TERM='' unless the TERM environment variable is passed explicitly + # see issues #11390 and #18300 + if 'TERM' not in env_vars: + env['TERM'] = '' + env.update(env_vars) cmd_line.extend(args) proc = subprocess.Popen(cmd_line, stdin=subprocess.PIPE, |