fix(hooks): probe WSL interop PATH before hardcoded paths

Adds 'pwsh.exe' and 'powershell.exe' as candidates to leverage
WSL's Windows interop PATH resolution, making the hook work with
non-default WSL mount prefixes or Windows drives.
This commit is contained in:
QWsin
2026-03-30 14:08:47 +08:00
parent 02206e87a5
commit 4ea72dec99

View File

@@ -42,7 +42,9 @@ function findPowerShell() {
if (!isWSL()) return null;
const candidates = [
'/mnt/c/Program Files/PowerShell/7/pwsh.exe', // PowerShell 7
'pwsh.exe', // WSL interop resolves from Windows PATH
'powershell.exe', // WSL interop for Windows PowerShell
'/mnt/c/Program Files/PowerShell/7/pwsh.exe', // PowerShell 7 (default install)
'/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe', // Windows PowerShell
];