Skip to content

Commit 729ae04

Browse files
committed
fix: add isUbuntu and skip getting ubuntu version on arch
1 parent f3cbe53 commit 729ae04

File tree

5 files changed

+22
-3
lines changed

5 files changed

+22
-3
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/isArch.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import which from "which"
33
let isArchCache: undefined | boolean = undefined
44

55
export function isArch(): boolean {
6+
if (process.platform !== "linux") {
7+
return false
8+
}
69
if (isArchCache === undefined) {
710
// detect arch by checking if pacman exists
811
isArchCache = which.sync("pacman", { nothrow: true }) !== null

src/utils/env/isUbuntu.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import which from "which"
2+
3+
let isUbuntuCache: undefined | boolean = undefined
4+
5+
export function isUbuntu(): boolean {
6+
if (process.platform !== "linux") {
7+
return false
8+
}
9+
if (isUbuntuCache === undefined) {
10+
const apt = "apt-get"
11+
isUbuntuCache = which.sync(apt, { nothrow: true }) !== null
12+
}
13+
14+
return isUbuntuCache
15+
}

src/utils/env/ubuntu_version.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { getUbuntuVersion } from "ubuntu-version"
2+
import { isUbuntu } from "./isUbuntu"
23

34
export async function ubuntuVersion(): Promise<number[] | null> {
4-
if (process.platform === "linux") {
5+
if (isUbuntu()) {
56
const versionSplitted = await getUbuntuVersion()
67

78
if (versionSplitted.length === 0) {

0 commit comments

Comments
 (0)