Skip to content

Commit

Permalink
* resolves conversation spyder-ide#12235 (comment)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Clary committed Oct 13, 2020
1 parent 31177c3 commit d29b269
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions spyder/utils/programs.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,17 +139,18 @@ def alter_subprocess_kwargs_by_platform(**kwargs):
CONSOLE_CREATION_FLAGS |= CREATE_NO_WINDOW
kwargs.setdefault('creationflags', CONSOLE_CREATION_FLAGS)

# ensure Windows subprocess environment has SYSTEMROOT, but variable
# is case insensitive
if ((kwargs.get('env') is not None) and
('SYSTEMROOT' not in map(str.upper, kwargs['env'].keys()))):
sys_root_key = None
for k, v in os.environ.items():
if 'SYSTEMROOT' == k.upper():
sys_root_key = k
break # don't risk multiple values
if sys_root_key is not None:
kwargs['env'].update({sys_root_key: os.environ[sys_root_key]})
# ensure Windows subprocess environment has SYSTEMROOT
if (kwargs.get('env') is not None):
# Is SYSTEMROOT in env? case insensitive
if ('SYSTEMROOT' not in map(str.upper, kwargs['env'].keys())):
# Add SYSTEMROOT from os.environ
sys_root_key = None
for k, v in os.environ.items():
if 'SYSTEMROOT' == k.upper():
sys_root_key = k
break # don't risk multiple values
if sys_root_key is not None:
kwargs['env'].update({sys_root_key: os.environ[sys_root_key]})

return kwargs

Expand Down

0 comments on commit d29b269

Please sign in to comment.