mirror of
https://github.com/Eugeny/tabby.git
synced 2024-11-26 03:27:23 +03:00
detect store-installed powershell - fixes #5212
This commit is contained in:
parent
d644c299ae
commit
0c601592e3
@ -73,21 +73,22 @@ export class WindowsStockShellsProvider extends ShellProvider {
|
||||
}
|
||||
|
||||
private async getPowerShellPath () {
|
||||
const ps = 'powershell.exe'
|
||||
|
||||
if (!await promisify(hasbin)(ps)) {
|
||||
for (const searchPath of [
|
||||
`${process.env.SystemRoot}\\System32\\WindowsPowerShell\\v1.0`,
|
||||
`${process.env.SystemRoot}\\System32`,
|
||||
process.env.SystemRoot ?? 'C:\\Windows',
|
||||
]) {
|
||||
const newPath = path.join(searchPath, ps)
|
||||
try {
|
||||
await fs.stat(newPath)
|
||||
return newPath
|
||||
} catch { }
|
||||
for (const name of ['pwsh.exe', 'powershell.exe']) {
|
||||
if (await promisify(hasbin)(name)) {
|
||||
return name
|
||||
}
|
||||
}
|
||||
return ps
|
||||
for (const psPath of [
|
||||
`${process.env.USERPROFILE}\\AppData\\Local\\Microsoft\\WindowsApps\\pwsh.exe`,
|
||||
`${process.env.SystemRoot}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`,
|
||||
`${process.env.SystemRoot}\\System32\\powershell.exe`,
|
||||
(process.env.SystemRoot ?? 'C:\\Windows') + '\\powerhshell.exe',
|
||||
]) {
|
||||
try {
|
||||
await fs.stat(psPath)
|
||||
return psPath
|
||||
} catch { }
|
||||
}
|
||||
return 'powershell.exe'
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user