Skip to content

Commit

Permalink
refactor(subprocess): use isExecutableFile from fs utils
Browse files Browse the repository at this point in the history
  • Loading branch information
imhoffd committed Mar 3, 2019
1 parent 53d9626 commit cea51c6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/@ionic/utils-subprocess/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { reduce } from '@ionic/utils-array';
import { pathExecutable, statSafe } from '@ionic/utils-fs';
import { isExecutableFile } from '@ionic/utils-fs';
import { createProcessEnv } from '@ionic/utils-process';
import { WritableStreamBuffer } from '@ionic/utils-stream';
import { ChildProcess, ForkOptions, SpawnOptions, fork as _fork } from 'child_process';
Expand Down Expand Up @@ -214,9 +214,8 @@ export async function which(command: string, { PATH = process.env.PATH || '' }:
}

const p = pathlib.join(v, command);
const [ stats, executable ] = await Promise.all([statSafe(p), pathExecutable(p)]);

if (stats && (stats.isFile() || stats.isSymbolicLink()) && executable) {
if (await isExecutableFile(p)) {
return p;
}

Expand Down

0 comments on commit cea51c6

Please # to comment.