mirror of https://github.com/aminya/setup-cpp
fix: add isUbuntu and skip getting ubuntu version on arch
This commit is contained in:
parent
f3cbe53fbc
commit
729ae041fc
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -3,6 +3,9 @@ import which from "which"
|
|||
let isArchCache: undefined | boolean = undefined
|
||||
|
||||
export function isArch(): boolean {
|
||||
if (process.platform !== "linux") {
|
||||
return false
|
||||
}
|
||||
if (isArchCache === undefined) {
|
||||
// detect arch by checking if pacman exists
|
||||
isArchCache = which.sync("pacman", { nothrow: true }) !== null
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
import which from "which"
|
||||
|
||||
let isUbuntuCache: undefined | boolean = undefined
|
||||
|
||||
export function isUbuntu(): boolean {
|
||||
if (process.platform !== "linux") {
|
||||
return false
|
||||
}
|
||||
if (isUbuntuCache === undefined) {
|
||||
const apt = "apt-get"
|
||||
isUbuntuCache = which.sync(apt, { nothrow: true }) !== null
|
||||
}
|
||||
|
||||
return isUbuntuCache
|
||||
}
|
|
@ -1,7 +1,8 @@
|
|||
import { getUbuntuVersion } from "ubuntu-version"
|
||||
import { isUbuntu } from "./isUbuntu"
|
||||
|
||||
export async function ubuntuVersion(): Promise<number[] | null> {
|
||||
if (process.platform === "linux") {
|
||||
if (isUbuntu()) {
|
||||
const versionSplitted = await getUbuntuVersion()
|
||||
|
||||
if (versionSplitted.length === 0) {
|
||||
|
|
Loading…
Reference in New Issue