fix: use exec-powershell in setup-cpp

This commit is contained in:
Amin Yahyaabadi 2022-08-07 17:05:55 -07:00
parent 46635fc18e
commit 4c866cd807
8 changed files with 8 additions and 30 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

2
dist/setup_cpp.mjs 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

@ -55,6 +55,7 @@
"@actions/io": "^1.1.2", "@actions/io": "^1.1.2",
"@actions/tool-cache": "^2.0.1", "@actions/tool-cache": "^2.0.1",
"escape-path-with-spaces": "^1.0.0", "escape-path-with-spaces": "^1.0.0",
"exec-powershell": "workspace:*",
"execa": "^5.1.1", "execa": "^5.1.1",
"mri": "^1.2.0", "mri": "^1.2.0",
"msvc-dev-cmd": "github:aminya/msvc-dev-cmd#9f672c1", "msvc-dev-cmd": "github:aminya/msvc-dev-cmd#9f672c1",

View File

@ -29,6 +29,7 @@ importers:
escape-path-with-spaces: ^1.0.0 escape-path-with-spaces: ^1.0.0
eslint: ^8.21.0 eslint: ^8.21.0
eslint-config-atomic: ^1.18.1 eslint-config-atomic: ^1.18.1
exec-powershell: workspace:*
execa: ^5.1.1 execa: ^5.1.1
jest: ^28.1.3 jest: ^28.1.3
loose-ts-check: ^1.2.0 loose-ts-check: ^1.2.0
@ -56,6 +57,7 @@ importers:
'@actions/io': 1.1.2 '@actions/io': 1.1.2
'@actions/tool-cache': 2.0.1 '@actions/tool-cache': 2.0.1
escape-path-with-spaces: 1.0.0 escape-path-with-spaces: 1.0.0
exec-powershell: link:packages/exec-powershell
execa: 5.1.1 execa: 5.1.1
mri: 1.2.0 mri: 1.2.0
msvc-dev-cmd: github.com/aminya/msvc-dev-cmd/9f672c1 msvc-dev-cmd: github.com/aminya/msvc-dev-cmd/9f672c1

View File

@ -3,7 +3,7 @@ import { isGitHubCI } from "./isCI"
import { untildify_user as untildify } from "../path/untildify" import { untildify_user as untildify } from "../path/untildify"
import { appendFileSync, existsSync, readFileSync } from "fs" import { appendFileSync, existsSync, readFileSync } from "fs"
import { error, warning } from "../io/io" import { error, warning } from "../io/io"
import { execPowershell } from "../exec/powershell" import { execPowershell } from "exec-powershell"
import { delimiter } from "path" import { delimiter } from "path"
import { escapeSpace } from "../path/escape_space" import { escapeSpace } from "../path/escape_space"

View File

@ -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
}