Skip to content

Commit a67e7ba

Browse files
committed
fix: use colored errors for local usage
1 parent 1077091 commit a67e7ba

File tree

6 files changed

+14
-12
lines changed

6 files changed

+14
-12
lines changed

dist/setup_cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/setup_cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/macos-sdk/macos-sdk.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { getExecOutput } from "@actions/exec"
2-
import * as core from "@actions/core"
32
import { addEnv } from "../utils/env/addEnv"
3+
import { error } from "../utils/io/io"
44

55
export async function setupMacOSSDK() {
66
if (process.platform === "darwin") {
@@ -10,10 +10,10 @@ export async function setupMacOSSDK() {
1010
if (sdkroot) {
1111
addEnv("SDKROOT", sdkroot.trim())
1212
} else {
13-
core.error(`SDKROOT not set`)
13+
error(`SDKROOT not set`)
1414
}
1515
} catch (e) {
16-
core.error(e as Error | string)
16+
error(e as Error | string)
1717
}
1818
}
1919
}

src/utils/env/addEnv.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { untildify_user as untildify } from "../path/untildify"
66
import { appendFileSync } from "fs"
77
import { join } from "path"
88
import { isRoot } from "./sudo"
9+
import { error } from "../io/io"
910

1011
/** An add path function that works locally or inside GitHub Actions */
1112
export function addEnv(name: string, val: string | undefined) {
@@ -17,12 +18,12 @@ export function addEnv(name: string, val: string | undefined) {
1718
}
1819
} catch (err) {
1920
try {
20-
core.error(err as Error)
21+
error(err as Error)
2122
return addEnvSystem(name, val)
2223
} catch (err2) {
23-
core.error(err2 as Error)
24+
error(err2 as Error)
2425
}
25-
core.error(`Failed to export environment variable ${name}=${val}. You should add it manually.`)
26+
error(`Failed to export environment variable ${name}=${val}. You should add it manually.`)
2627
}
2728
}
2829

src/utils/io/io.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ export function success(msg: string) {
1111

1212
export function warning(msg: string) {
1313
return isGitHubCI() ? core.warning(msg) : console.log(`\x1b[33m${msg}\x1b[0m`)
14-
}
14+
}

src/utils/path/addPath.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import execa from "execa"
55
import { isGitHubCI } from "../env/isci"
66
import { untildify_user as untildify } from "./untildify"
77
import { appendFileSync } from "fs"
8+
import { error } from "../io/io"
89

910
/** An add path function that works locally or inside GitHub Actions */
1011
export function addPath(path: string) {
@@ -16,12 +17,12 @@ export function addPath(path: string) {
1617
}
1718
} catch (err) {
1819
try {
19-
core.error(err as Error)
20+
error(err as Error)
2021
return addPathSystem(path)
2122
} catch (err2) {
22-
core.error(err2 as Error)
23+
error(err2 as Error)
2324
}
24-
core.error(`Failed to add ${path} to the percistent PATH. You should add it manually.`)
25+
error(`Failed to add ${path} to the percistent PATH. You should add it manually.`)
2526
}
2627
}
2728

0 commit comments

Comments
 (0)