fix: trim sdkroot output

This commit is contained in:
Amin Yahyaabadi 2021-12-11 17:21:44 -06:00
parent ab471df24f
commit 3b3e893ce4
4 changed files with 6 additions and 5 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

@ -7,7 +7,7 @@ export async function setupMacOSSDK() {
const xcrun = await getExecOutput("xcrun --sdk macosx --show-sdk-path")
const sdkroot = xcrun.stdout || xcrun.stderr
if (sdkroot) {
core.exportVariable("SDKROOT", sdkroot)
core.exportVariable("SDKROOT", sdkroot.trim())
} else {
core.error(`SDKROOT not set`)
}

View File

@ -58,8 +58,9 @@ export const defaultVersionRegex = /v?(\d\S*)/
/** Get the version of a binary */
export async function getBinVersion(file: string, versionRegex: RegExp = defaultVersionRegex) {
try {
const { stderr, stdout } = await getExecOutput(file, ["--version"])
const version = stdout.match(versionRegex)?.[1] ?? stderr.match(versionRegex)?.[1]
const execout = await getExecOutput(file, ["--version"])
const version_output = execout.stdout || execout.stderr || ""
const version = version_output.trim().match(versionRegex)?.[1]
return version
} catch (e) {
console.error(e)