mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
Escape & on Windows in shell using ^& in run_subprocess
This commit is contained in:
parent
f6c80f9ae3
commit
516dd2d7ce
1 changed files with 10 additions and 0 deletions
|
|
@ -122,6 +122,16 @@ def run_subprocess(*args, **kwargs):
|
|||
)
|
||||
args = (new_arg, )
|
||||
|
||||
# Escape & on Windows in shell using ^&
|
||||
if (
|
||||
kwargs.get("shell") is True
|
||||
and len(args) == 1
|
||||
and isinstance(args[0], str)
|
||||
and platform.system().lower() == "windows"
|
||||
):
|
||||
new_arg = args[0].replace("&", "^&")
|
||||
args = (new_arg, )
|
||||
|
||||
# Get environents from kwarg or use current process environments if were
|
||||
# not passed.
|
||||
env = kwargs.get("env") or os.environ
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue