gst-env: Add support for PowerShell 7

The executable binary name of "PowerShell 7" is "pwsh.exe"
which is different from system default installed
"Windows PowerShell (version 5.x or older)"

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2545>
This commit is contained in:
Seungha Yang 2022-06-03 03:22:03 +09:00 committed by GStreamer Marge Bot
parent 77937f9398
commit 12fdf93ba4
2 changed files with 3 additions and 4 deletions

View file

@ -2,7 +2,7 @@ $i=1
$ppid=(gwmi win32_process -Filter "processid='$pid'").parentprocessid
$pname=(Get-Process -id $ppid).Name
While($true) {
if($pname -eq "cmd" -Or $pname -eq "powershell") {
if($pname -eq "cmd" -Or $pname -eq "powershell" -Or $pname -eq "pwsh") {
Write-Host ("{0}.exe" -f $pname)
Break
}

View file

@ -549,9 +549,8 @@ if __name__ == "__main__":
env = get_subprocess_env(options, gst_version)
if os.name == 'nt':
shell = get_windows_shell()
if shell == 'powershell.exe':
new_args = ['powershell.exe']
new_args += ['-NoLogo']
if shell in ['powershell.exe', 'pwsh.exe']:
new_args = [shell, '-NoLogo']
if not args:
prompt = 'function global:prompt { "[gst-' + gst_version + '"+"] PS " + $PWD + "> "}'
new_args += ['-NoExit', '-Command', prompt]