Skip to content

Commit

Permalink
musl platform check if linux
Browse files Browse the repository at this point in the history
  • Loading branch information
YOU54F committed Feb 15, 2024
1 parent 8dfb0ce commit 66687cf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/pact-standalone.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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 =>
Expand Down
5 changes: 3 additions & 2 deletions standalone/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,9 @@ function extract(data: Data): Promise<Data> {
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';
}
Expand Down

0 comments on commit 66687cf

Please sign in to comment.