aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorSeungha Yang <seungha@centricular.com>2022-06-15 06:59:33 +0900
committerXavier Claessens <xclaesse@gmail.com>2022-06-14 19:09:25 -0400
commitee7a7fec10298e8dabc423f6163e866d19473e7f (patch)
treea5da9b8d6f1f640691451bf9d2707c56cb49fecb /mesonbuild
parentd85a9733e6af45c9e3111f23ecec9e614eaeaeeb (diff)
downloadmeson-ee7a7fec10298e8dabc423f6163e866d19473e7f.zip
meson-ee7a7fec10298e8dabc423f6163e866d19473e7f.tar.gz
meson-ee7a7fec10298e8dabc423f6163e866d19473e7f.tar.bz2
devenv: Add support for PowerShell 7 on Windows
Checks "pwsh.exe" in addition to "powershell.exe" and "cmd.exe" to support PowerShell 7 on Windows. The Powershell 7 support was added in GStreamer (which is the origin of this script) already via https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2545
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/mdevenv.py5
-rw-r--r--mesonbuild/scripts/cmd_or_ps.ps12
2 files changed, 3 insertions, 4 deletions
diff --git a/mesonbuild/mdevenv.py b/mesonbuild/mdevenv.py
index 041d22d..46b301c 100644
--- a/mesonbuild/mdevenv.py
+++ b/mesonbuild/mdevenv.py
@@ -185,9 +185,8 @@ def run(options: argparse.Namespace) -> int:
args = [shell_env]
elif is_windows():
shell = get_windows_shell()
- if shell == 'powershell.exe':
- args = ['powershell.exe']
- args += ['-NoLogo', '-NoExit']
+ if shell in ['powershell.exe', 'pwsh.exe']:
+ args = [shell, '-NoLogo', '-NoExit']
prompt = f'function global:prompt {{ "{prompt_prefix} PS " + $PWD + "> "}}'
args += ['-Command', prompt]
else:
diff --git a/mesonbuild/scripts/cmd_or_ps.ps1 b/mesonbuild/scripts/cmd_or_ps.ps1
index 884d7e0..1d677d9 100644
--- a/mesonbuild/scripts/cmd_or_ps.ps1
+++ b/mesonbuild/scripts/cmd_or_ps.ps1
@@ -5,7 +5,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
}