mirror of https://github.com/aminya/setup-cpp
fix: use exec-powershell in setup-cpp
This commit is contained in:
parent
46635fc18e
commit
4c866cd807
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -55,6 +55,7 @@
|
|||
"@actions/io": "^1.1.2",
|
||||
"@actions/tool-cache": "^2.0.1",
|
||||
"escape-path-with-spaces": "^1.0.0",
|
||||
"exec-powershell": "workspace:*",
|
||||
"execa": "^5.1.1",
|
||||
"mri": "^1.2.0",
|
||||
"msvc-dev-cmd": "github:aminya/msvc-dev-cmd#9f672c1",
|
||||
|
|
|
@ -29,6 +29,7 @@ importers:
|
|||
escape-path-with-spaces: ^1.0.0
|
||||
eslint: ^8.21.0
|
||||
eslint-config-atomic: ^1.18.1
|
||||
exec-powershell: workspace:*
|
||||
execa: ^5.1.1
|
||||
jest: ^28.1.3
|
||||
loose-ts-check: ^1.2.0
|
||||
|
@ -56,6 +57,7 @@ importers:
|
|||
'@actions/io': 1.1.2
|
||||
'@actions/tool-cache': 2.0.1
|
||||
escape-path-with-spaces: 1.0.0
|
||||
exec-powershell: link:packages/exec-powershell
|
||||
execa: 5.1.1
|
||||
mri: 1.2.0
|
||||
msvc-dev-cmd: github.com/aminya/msvc-dev-cmd/9f672c1
|
||||
|
|
|
@ -3,7 +3,7 @@ import { isGitHubCI } from "./isCI"
|
|||
import { untildify_user as untildify } from "../path/untildify"
|
||||
import { appendFileSync, existsSync, readFileSync } from "fs"
|
||||
import { error, warning } from "../io/io"
|
||||
import { execPowershell } from "../exec/powershell"
|
||||
import { execPowershell } from "exec-powershell"
|
||||
import { delimiter } from "path"
|
||||
import { escapeSpace } from "../path/escape_space"
|
||||
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
import execa from "execa"
|
||||
import which from "which"
|
||||
|
||||
let powershell: string | undefined
|
||||
|
||||
export function execPowershell(command: string, startupFlags: string[] = ["-NoProfile", "-NoLogo", "-NonInteractive"]) {
|
||||
return execa(getPowerShell(), [...startupFlags, "-c", command], { stdio: "inherit" })
|
||||
}
|
||||
|
||||
function getPowerShell() {
|
||||
if (powershell === undefined) {
|
||||
const maybePwsh = which.sync("pwsh", { nothrow: true })
|
||||
if (maybePwsh !== null) {
|
||||
powershell = maybePwsh
|
||||
}
|
||||
const maybePowerShell = which.sync("powershell", { nothrow: true })
|
||||
if (maybePowerShell !== null) {
|
||||
powershell = maybePowerShell
|
||||
}
|
||||
}
|
||||
if (powershell === undefined) {
|
||||
throw new Error("Could not find powershell")
|
||||
}
|
||||
return powershell
|
||||
}
|
Loading…
Reference in New Issue