fix: faster execPowershell by adding -NoProfile, etc.

PowerShell is much faster this way
This commit is contained in:
Amin Yahyaabadi 2022-05-12 12:43:13 -07:00
parent 0286b4c7c4
commit 8fdba4c150
3 changed files with 4 additions and 4 deletions

2
dist/setup_cpp.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -3,7 +3,7 @@ import which from "which"
let powershell: string | undefined let powershell: string | undefined
export function execPowershell(command: string) { export function execPowershell(command: string, startupFlags: string[] = ["-NoProfile", "-NoLogo", "-NonInteractive"]) {
if (powershell === undefined) { if (powershell === undefined) {
const maybePwsh = which.sync("pwsh", { nothrow: true }) const maybePwsh = which.sync("pwsh", { nothrow: true })
if (maybePwsh !== null) { if (maybePwsh !== null) {
@ -18,5 +18,5 @@ export function execPowershell(command: string) {
throw new Error("Could not find powershell") throw new Error("Could not find powershell")
} }
execa.sync(powershell, ["-c", command], { stdio: "inherit" }) execa.sync(powershell, [...startupFlags, "-c", command], { stdio: "inherit" })
} }