Skip to content

Commit

Permalink
🐛 Issue with which, try to use it directly
Browse files Browse the repository at this point in the history
Fix #53 #58
  • Loading branch information
bchatard committed Sep 14, 2019
1 parent 1a0b3a9 commit 5e7b5af
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 22 deletions.
92 changes: 78 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
"homepage": "https://github.com/bchatard/alfred-jetbrains#readme",
"dependencies": {
"alfy": "^0.9.0",
"execa": "^1.0.0",
"execa": "^2.0.4",
"fast-xml-parser": "^3.12.16",
"fuse.js": "^3.4.4"
"fuse.js": "^3.4.4",
"which": "^1.3.1"
},
"publishConfig": {
"access": "public"
Expand Down
7 changes: 2 additions & 5 deletions src/product.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const alfy = require("alfy");
const fs = require("fs");
const path = require("path");
const execa = require("execa");
const which = require("which");

const knownProducts = require("./products.json");

Expand Down Expand Up @@ -79,11 +80,7 @@ const getPreferencePath = product => {

const getApplicationPath = product => {
const bin = product.bin;
const result = execa.shellSync(`which ${bin}`);
if (result.failed) {
throw new Error(result.stderr);
}
product.binPath = result.stdout;
product.binPath = which.sync(bin, { nothrow: true });
const binContent = fs.readFileSync(product.binPath, { encoding: "UTF-8" });

// Toolbox case
Expand Down
2 changes: 1 addition & 1 deletion src/project/name.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const getProductName = projectPath => {
}

for (const xpath of workspaceXpath) {
const result = execa.shellSync(
const result = execa.commandSync(
`xmllint --xpath "${xpath}" workspace.xml`,
{ reject: false }
);
Expand Down

0 comments on commit 5e7b5af

Please sign in to comment.