Skip to content

Commit

Permalink
Handling the case where sh is not available and allowing an empty menu
Browse files Browse the repository at this point in the history
  • Loading branch information
tper0700 committed Apr 17, 2020
1 parent ce32b43 commit 8200a48
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -891,10 +891,14 @@ function checkIfCommandExists(app) {
// Quotes around app value are important. They let command operate
// on the whole value, instead of having shell interpret it.
let cmd = "sh -c 'command -v \"" + app + "\"'";
let out = GLib.spawn_command_line_sync(cmd);
try {
let out = GLib.spawn_command_line_sync(cmd);
// out contains 1: stdout, 2: stderr, 3: exit code
answer = out[3] == 0;
} catch {
answer = false;
}

// out contains 1: stdout, 2: stderr, 3: exit code
answer = out[3] == 0;
checkedCommandsMap.set(app, answer);
}
return answer;
Expand Down

0 comments on commit 8200a48

Please sign in to comment.