From 66687cfab453043424320d12d8875059e41d7d5f Mon Sep 17 00:00:00 2001 From: Yousaf Nabi Date: Thu, 15 Feb 2024 23:23:27 +0000 Subject: [PATCH] musl platform check if linux --- src/pact-standalone.ts | 8 ++++++++ standalone/install.ts | 5 +++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/pact-standalone.ts b/src/pact-standalone.ts index c310a24d..75ee264c 100644 --- a/src/pact-standalone.ts +++ b/src/pact-standalone.ts @@ -1,6 +1,7 @@ import * as path from 'path'; import { getBinaryEntry } from '../standalone/install'; import pactEnvironment from './pact-environment'; +import fs = require('fs'); export interface PactStandalone { cwd: string; @@ -26,6 +27,13 @@ export const standalone = ( platform: string = process.platform, arch: string = process.arch ): PactStandalone => { + if ( + platform === 'linux' && + (fs.existsSync('/lib/libc.musl-x86_64.so.1') || + fs.existsSync('/lib/libc.musl-aarch64.so.1')) + ) { + platform = 'linux-musl'; + } const binName = (name: string): string => `${name}${pactEnvironment.isWindows(platform) ? '.bat' : ''}`; const exeName = (name: string): string => diff --git a/standalone/install.ts b/standalone/install.ts index c683112c..90ef4e4d 100644 --- a/standalone/install.ts +++ b/standalone/install.ts @@ -393,8 +393,9 @@ function extract(data: Data): Promise { export function getBinaryEntry(platform?: string, arch?: string): BinaryEntry { platform = platform || process.platform; if ( - fs.existsSync('/lib/libc.musl-x86_64.so.1') || - fs.existsSync('/lib/libc.musl-aarch64.so.1') + platform === 'linux' && + (fs.existsSync('/lib/libc.musl-x86_64.so.1') || + fs.existsSync('/lib/libc.musl-aarch64.so.1')) ) { platform = 'linux-musl'; }