Skip to content
This repository was archived by the owner on Aug 7, 2023. It is now read-only.

Commit 1009db8

Browse files
Merge pull request #2 from UziTech/which
fix: use which npm package for windows compatibility
2 parents c532bbe + d4ddfee commit 1009db8

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

lib/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ class LinterESLintNode {
257257
projectPath
258258
});
259259
} catch (err) {
260-
if (err.name = 'InvalidWorkerError') {
260+
if (err.name === 'InvalidWorkerError') {
261261
// Worker script can't run. Fill in some dummy values here.
262262
response = {
263263
eslintPath: '(unknown)',

lib/node-path-tester.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use babel';
22
import { existsSync } from 'fs';
33
import { exec, execSync } from 'child_process';
4+
import which from 'which';
45

56
const NodePathTester = {
67
_timeout: null,
@@ -35,11 +36,11 @@ const NodePathTester = {
3536
resolve (bin) {
3637
if (bin.startsWith('/') && existsSync(bin) ) { return Promise.resolve(bin); }
3738
return new Promise((resolve, reject) => {
38-
exec(`which ${bin}`, (err, stdout) => {
39+
which(bin, (err, resolvedPath) => {
3940
if (err) {
4041
reject(err);
4142
} else {
42-
resolve(stdout);
43+
resolve(resolvedPath);
4344
}
4445
});
4546
});

package-lock.json

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@
159159
"atom-package-deps": "^8.0.0",
160160
"compare-versions": "^4.1.3",
161161
"eslint": "^8.9.0",
162-
"ndjson": "^2.0.0"
162+
"ndjson": "^2.0.0",
163+
"which": "^2.0.2"
163164
}
164165
}

0 commit comments

Comments
 (0)