mirror of https://github.com/aminya/setup-cpp
fix: trim sdkroot output
This commit is contained in:
parent
ab471df24f
commit
3b3e893ce4
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -7,7 +7,7 @@ export async function setupMacOSSDK() {
|
||||||
const xcrun = await getExecOutput("xcrun --sdk macosx --show-sdk-path")
|
const xcrun = await getExecOutput("xcrun --sdk macosx --show-sdk-path")
|
||||||
const sdkroot = xcrun.stdout || xcrun.stderr
|
const sdkroot = xcrun.stdout || xcrun.stderr
|
||||||
if (sdkroot) {
|
if (sdkroot) {
|
||||||
core.exportVariable("SDKROOT", sdkroot)
|
core.exportVariable("SDKROOT", sdkroot.trim())
|
||||||
} else {
|
} else {
|
||||||
core.error(`SDKROOT not set`)
|
core.error(`SDKROOT not set`)
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,8 +58,9 @@ export const defaultVersionRegex = /v?(\d\S*)/
|
||||||
/** Get the version of a binary */
|
/** Get the version of a binary */
|
||||||
export async function getBinVersion(file: string, versionRegex: RegExp = defaultVersionRegex) {
|
export async function getBinVersion(file: string, versionRegex: RegExp = defaultVersionRegex) {
|
||||||
try {
|
try {
|
||||||
const { stderr, stdout } = await getExecOutput(file, ["--version"])
|
const execout = await getExecOutput(file, ["--version"])
|
||||||
const version = stdout.match(versionRegex)?.[1] ?? stderr.match(versionRegex)?.[1]
|
const version_output = execout.stdout || execout.stderr || ""
|
||||||
|
const version = version_output.trim().match(versionRegex)?.[1]
|
||||||
return version
|
return version
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
|
|
Loading…
Reference in New Issue