Skip to content

Commit

Permalink
fix: full path to ldconfig in linux (#3401)
Browse files Browse the repository at this point in the history
  • Loading branch information
aslushnikov authored Aug 12, 2020
1 parent 4061bc6 commit c035560
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/server/validateDependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,14 @@ async function missingDLOPENLibraries(browser: BrowserDescriptor): Promise<strin
const libraries = DL_OPEN_LIBRARIES[browser.name];
if (!libraries.length)
return [];
const {stdout, code} = await spawnAsync('ldconfig', ['-p'], {});
if (code !== 0)
const {stdout, code, error} = await spawnAsync('/sbin/ldconfig', ['-p'], {});
if (code !== 0 || error)
return [];
const isLibraryAvailable = (library: string) => stdout.toLowerCase().includes(library.toLowerCase());
return libraries.filter(library => !isLibraryAvailable(library));
}

function spawnAsync(cmd: string, args: string[], options: any): Promise<{stdout: string, stderr: string, code: number}> {
function spawnAsync(cmd: string, args: string[], options: any): Promise<{stdout: string, stderr: string, code: number, error?: Error}> {
const process = spawn(cmd, args, options);

return new Promise(resolve => {
Expand All @@ -236,6 +236,7 @@ function spawnAsync(cmd: string, args: string[], options: any): Promise<{stdout:
process.stdout.on('data', data => stdout += data);
process.stderr.on('data', data => stderr += data);
process.on('close', code => resolve({stdout, stderr, code}));
process.on('error', error => resolve({stdout, stderr, code: 0, error}));
});
}

Expand Down

0 comments on commit c035560

Please sign in to comment.