Skip to content

Commit 9b38d10

Browse files
committed
fix: make addPath sync
1 parent 34bf57d commit 9b38d10

File tree

11 files changed

+17
-17
lines changed

11 files changed

+17
-17
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/cppcheck/cppcheck.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export async function setupCppcheck(version: string | undefined, _setupCppDir: s
99
case "win32": {
1010
await setupChocoPack("cppcheck", version)
1111
const binDir = "C:/Program Files/Cppcheck"
12-
await addPath(binDir)
12+
addPath(binDir)
1313
return { binDir }
1414
}
1515
case "darwin": {

src/doxygen/doxygen.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ export async function setupDoxygen(version: string | undefined, _setupCppDir: st
99
case "win32": {
1010
await setupChocoPack("doxygen.install", version)
1111
await setupChocoPack("graphviz", version)
12-
await addPath("C:/Program Files/Graphviz/bin")
12+
addPath("C:/Program Files/Graphviz/bin")
1313
const binDir = "C:/Program Files/doxygen/bin"
14-
await addPath(binDir)
14+
addPath(binDir)
1515
return { binDir }
1616
}
1717
case "darwin": {

src/gcc/gcc.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ export async function setupGcc(version: string, _setupCppDir: string, arch: stri
1818
await setupChocoPack("mingw", version)
1919
if (arch === "x64" && existsSync("C:/tools/mingw64/bin")) {
2020
binDir = "C:/tools/mingw64/bin"
21-
await addPath(binDir)
21+
addPath(binDir)
2222
} else if (arch === "ia32" && existsSync("C:/tools/mingw32/bin")) {
2323
binDir = "C:/tools/mingw32/bin"
24-
await addPath(binDir)
24+
addPath(binDir)
2525
} else if (existsSync("C:/ProgramData/Chocolatey/bin/g++.exe")) {
2626
binDir = "C:/ProgramData/Chocolatey/bin/"
2727
}

src/opencppcoverage/opencppcoverage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ export async function setupOpencppcoverage(version: string | undefined, _setupCp
88
}
99
await setupChocoPack("opencppcoverage", version)
1010
const binDir = "C:/Program Files/OpenCppCoverage"
11-
await addPath(binDir)
11+
addPath(binDir)
1212
return { binDir }
1313
}

src/python/python.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export async function setupPythonViaSystem(version: string, setupCppDir: string,
5050
// Adding the bin dir to the path
5151
/** The directory which the tool is installed to */
5252
core.info(`Add ${binDir} to PATH`)
53-
await addPath(binDir)
53+
addPath(binDir)
5454

5555
return { installDir, binDir }
5656
}

src/utils/path/addPath.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ import * as core from "@actions/core"
44
import execa from "execa"
55

66
/** An add path function that works locally or inside GitHub Actions */
7-
export async function addPath(path: string) {
7+
export function addPath(path: string) {
88
try {
99
ghAddPath(path)
1010
} catch (err) {
1111
try {
1212
core.error(err as Error)
1313
switch (process.platform) {
1414
case "win32": {
15-
await execa(`setx PATH=${path};%PATH%`)
15+
execa.sync(`setx PATH=${path};%PATH%`)
1616
return
1717
}
1818
case "linux":
1919
case "darwin": {
20-
await execa.command(`echo "export PATH=${path}:$PATH" >> ~/.profile`)
21-
await execa.command(`source ~/.profile`)
20+
execa.commandSync(`echo "export PATH=${path}:$PATH" >> ~/.profile`)
21+
execa.commandSync(`source ~/.profile`)
2222
core.info(`${path} was added to ~/.profile`)
2323
return
2424
}

src/utils/setup/setupBin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export async function setupBin(
5555
info(`${name} ${version} was found in the cache.`)
5656
const installDir = join(dir, extractedFolderName)
5757
const binDir = join(installDir, binRelativeDir)
58-
await addPath(binDir)
58+
addPath(binDir)
5959
return { installDir, binDir }
6060
}
6161
} catch {
@@ -80,7 +80,7 @@ export async function setupBin(
8080
// Adding the bin dir to the path
8181
/** The directory which the tool is installed to */
8282
info(`Add ${binDir} to PATH`)
83-
await addPath(binDir)
83+
addPath(binDir)
8484

8585
// check if inside Github Actions. If so, cache the installation
8686
if (isCI() && typeof process.env.RUNNER_TOOL_CACHE === "string") {

src/utils/setup/setupChocoPack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ export async function setupChocoPack(name: string, version?: string, args: strin
2121
}
2222

2323
const binDir = "C:/ProgramData/Chocolatey/bin/"
24-
await addPath(binDir)
24+
addPath(binDir)
2525
return { binDir }
2626
}

0 commit comments

Comments
 (0)