Skip to content

Commit 777ee3f

Browse files
committed
fix: fix addPathSystem/addEnvSystem fallback
1 parent a4e2df0 commit 777ee3f

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
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/utils/env/addEnv.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ export async function addEnv(name: string, valGiven: string | undefined, shouldE
1212
const val = shouldEscapeSpace ? escapeSpace(valGiven) : valGiven
1313
try {
1414
if (isGitHubCI()) {
15-
exportVariable(name, val)
15+
try {
16+
exportVariable(name, val)
17+
} catch (err) {
18+
error(err as Error)
19+
await addEnvSystem(name, val)
20+
}
1621
} else {
1722
await addEnvSystem(name, val)
1823
}
1924
} catch (err) {
20-
try {
21-
error(err as Error)
22-
return addEnvSystem(name, val)
23-
} catch (err2) {
24-
error(err2 as Error)
25-
}
25+
error(err as Error)
2626
setFailed(`Failed to export environment variable ${name}=${val}. You should add it manually.`)
2727
}
2828
}
@@ -32,17 +32,17 @@ export async function addPath(path: string) {
3232
process.env.PATH = `${path}${delimiter}${process.env.PATH}`
3333
try {
3434
if (isGitHubCI()) {
35-
ghAddPath(path)
35+
try {
36+
ghAddPath(path)
37+
} catch (err) {
38+
error(err as Error)
39+
await addPathSystem(path)
40+
}
3641
} else {
3742
await addPathSystem(path)
3843
}
3944
} catch (err) {
40-
try {
41-
error(err as Error)
42-
return addPathSystem(path)
43-
} catch (err2) {
44-
error(err2 as Error)
45-
}
45+
error(err as Error)
4646
setFailed(`Failed to add ${path} to the percistent PATH. You should add it manually.`)
4747
}
4848
}

0 commit comments

Comments
 (0)