mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-16 11:15:31 +00:00
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>
This commit is contained in:
parent
fff82f5650
commit
d63a2c786b
1 changed files with 17 additions and 9 deletions
26
gst-env.py
26
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
|
||||
|
|
Loading…
Reference in a new issue