diff options
author | Jordan Petridis <jordan@centricular.com> | 2022-05-09 12:46:19 +0300 |
---|---|---|
committer | GStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org> | 2022-05-15 09:34:58 +0000 |
commit | d63a2c786bac552d6f9d4fe122047a603be056f6 (patch) | |
tree | 9d4d8a089a4d5b4cc534fb148ecb4122a563bc59 /gst-env.py | |
parent | fff82f565074d6f8fd0b6015d03d04169bba6e83 (diff) | |
download | gstreamer-d63a2c786bac552d6f9d4fe122047a603be056f6.tar.gz |
gst-env: spawn a shell to execute commands on windows
On windows, if you are not using built-in commands you need
to pass the full path of your executable into the subprocess.call/
Popen syscall. ex `c:/foo/bar/baz.exe`. This get's long and is
not ergonomic when you want to run trivial task like:
`gst-env.py ninja` or `gst-inspect0.0` or `gst-validate-launcher`
Instead, on windows, always launch a shell to be able to resolve
the executable from the PATH.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2397>
Diffstat (limited to 'gst-env.py')
-rwxr-xr-x | gst-env.py | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/gst-env.py b/gst-env.py index d4a0ef6885..51fb913218 100755 --- a/gst-env.py +++ b/gst-env.py @@ -547,18 +547,26 @@ if __name__ == "__main__": gst_version += '-' + os.path.basename(options.wine) env = get_subprocess_env(options, gst_version) - if not args: - if os.name == 'nt': - shell = get_windows_shell() - if shell == 'powershell.exe': - args = ['powershell.exe'] - args += ['-NoLogo', '-NoExit'] + if os.name == 'nt': + shell = get_windows_shell() + if shell == 'powershell.exe': + new_args = ['powershell.exe'] + new_args += ['-NoLogo'] + if not args: prompt = 'function global:prompt { "[gst-' + gst_version + '"+"] PS " + $PWD + "> "}' - args += ['-Command', prompt] + new_args += ['-NoExit', '-Command', prompt] else: - args = [os.environ.get("COMSPEC", r"C:\WINDOWS\system32\cmd.exe")] - args += ['/k', 'prompt [gst-{}] $P$G'.format(gst_version)] + new_args += ['-NonInteractive', '-Command'] + args + args = new_args else: + new_args = [os.environ.get("COMSPEC", r"C:\WINDOWS\system32\cmd.exe")] + if not args: + new_args += ['/k', 'prompt [gst-{}] $P$G'.format(gst_version)] + else: + new_args += ['/c', 'start', '/b', '/wait'] + args + args = new_args + if not args: + if os.name != 'nt': args = [os.environ.get("SHELL", os.path.realpath("/bin/sh"))] if args[0].endswith('bash') and not str_to_bool(os.environ.get("GST_BUILD_DISABLE_PS1_OVERRIDE", r"FALSE")): # Let the GC remove the tmp file |