Skip to content

Commit 0fa8654

Browse files
committed
fix: fix apt resolving on non-Linux
1 parent 928af1e commit 0fa8654

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

dist/legacy/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/legacy/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.

dist/modern/setup-cpp.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

dist/modern/setup-cpp.mjs.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.

packages/setup-apt/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "setup-apt",
3-
"version": "3.1.1",
3+
"version": "3.1.2",
44
"description": "Setup apt packages and repositories in Debian/Ubuntu-based distributions",
55
"repository": "https://github.com/aminya/setup-cpp",
66
"homepage": "https://github.com/aminya/setup-cpp/tree/master/packages/setup-apt",

packages/setup-apt/src/get-apt.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,28 @@ import which from "which"
44
* Check if nala is installed
55
*/
66
export function hasNala() {
7-
return which.sync("nala", { nothrow: true }) !== null
7+
return process.platform === "linux" && which.sync("nala", { nothrow: true }) !== null
88
}
99

1010
/**
1111
* Check if apt-fast is installed
1212
*/
1313
export function hasAptFast() {
14-
return which.sync("apt-fast", { nothrow: true }) !== null
14+
return process.platform === "linux" && which.sync("apt-fast", { nothrow: true }) !== null
1515
}
1616

1717
/**
1818
* Check if apt is installed
1919
*/
2020
export function hasApt() {
21-
return which.sync("apt", { nothrow: true }) !== null
21+
return process.platform === "linux" && which.sync("apt", { nothrow: true }) !== null
2222
}
2323

2424
/**
2525
* Check if apt-get is installed
2626
*/
2727
export function hasAptGet() {
28-
return which.sync("apt-get", { nothrow: true }) !== null
28+
return process.platform === "linux" && which.sync("apt-get", { nothrow: true }) !== null
2929
}
3030

3131
/**

src/gcovr/gcovr.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { addEnv } from "envosman"
22
import semverMajor from "semver/functions/major"
33
import semverValid from "semver/functions/valid"
4-
import { hasApt, installAptPack } from "setup-apt"
4+
import { hasAptGet, installAptPack } from "setup-apt"
55
import { rcOptions } from "../options.js"
66
import { setupPipPack } from "../utils/setup/setupPipPack.js"
77

88
// eslint-disable-next-line @typescript-eslint/no-unused-vars
99
export function setupGcovr(version: string | undefined, _setupDir: string, _arch: string) {
10-
if (hasApt() && (version === undefined || version === "")) {
10+
if (hasAptGet() && (version === undefined || version === "")) {
1111
// use apt on Ubuntu/Debian if version is not specified
1212
return installAptPack([{ name: "gcovr", version }])
1313
}

0 commit comments

Comments
 (0)