mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Merge pull request #857 from pypeclub/bugfix/env_change_on_app_launch
Create dict copy of environments on application launch
This commit is contained in:
commit
5806713004
1 changed files with 13 additions and 6 deletions
|
|
@ -1,5 +1,4 @@
|
|||
import os
|
||||
import copy
|
||||
import platform
|
||||
import inspect
|
||||
import subprocess
|
||||
|
|
@ -531,15 +530,23 @@ class ApplicationLaunchContext:
|
|||
self.launch_args = executable.as_args()
|
||||
|
||||
# Handle launch environemtns
|
||||
passed_env = self.data.pop("env", None)
|
||||
if passed_env is None:
|
||||
env = self.data.pop("env", None)
|
||||
if env is not None and not isinstance(env, dict):
|
||||
self.log.warning((
|
||||
"Passed `env` kwarg has invalid type: {}. Expected: `dict`."
|
||||
" Using `os.environ` instead."
|
||||
).format(str(type(env))))
|
||||
env = None
|
||||
|
||||
if env is None:
|
||||
env = os.environ
|
||||
else:
|
||||
env = passed_env
|
||||
|
||||
# subprocess.Popen keyword arguments
|
||||
self.kwargs = {
|
||||
"env": copy.deepcopy(env)
|
||||
"env": {
|
||||
key: str(value)
|
||||
for key, value in env.items()
|
||||
}
|
||||
}
|
||||
|
||||
if platform.system().lower() == "windows":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue