Skip to content

Commit 0cbf8bc

Browse files
committed
Avoid warning if any capitalization of SystemRoot in env has a nonempty value.
1 parent 80afcbc commit 0cbf8bc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Lib/subprocess.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1545,7 +1545,8 @@ def _execute_child(self, args, executable, preexec_fn, close_fds,
15451545
if cwd is not None:
15461546
cwd = os.fsdecode(cwd)
15471547

1548-
if env is not None and not env.get('SystemRoot'):
1548+
if env is not None and not any(
1549+
k.upper() == 'SYSTEMROOT' and v for k, v in env.items()):
15491550
warnings.warn("env lacks a valid 'SystemRoot'.", RuntimeWarning)
15501551

15511552
sys.audit("subprocess.Popen", executable, args, cwd, env)

0 commit comments

Comments
 (0)