Skip to content

Commit

Permalink
🐛 Fix a destructuring typo
Browse files Browse the repository at this point in the history
  • Loading branch information
steelbrain committed Feb 3, 2016
1 parent b68452b commit 8c6e445
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function _exec(command, args, opts, isNode) {
return new Promise(function (resolve, reject) {
const data = { stdout: [], stderr: [] };
const handleError = function (error) {
if (error.code === 'EACCES' || error.message.indexOf(COMMAND_NOT_RECOGNIZED_MESSAGE) !== -1) {
if (error.code === 'EACCES' || error.message && error.message.indexOf(COMMAND_NOT_RECOGNIZED_MESSAGE) !== -1) {
const newError = new Error(`Failed to spawn command '${ command }'.` + ` Make sure it's a file, not a directory, and it's executable.`);
newError.name = 'BufferedProcessError';
reject(newError);
Expand Down Expand Up @@ -96,7 +96,9 @@ function _exec(command, args, opts, isNode) {
};
const spawnedProcess = isNode ? new _atom.BufferedNodeProcess(parameters) : new _atom.BufferedProcess(parameters);

spawnedProcess.onWillThrowError(function (error) {
spawnedProcess.onWillThrowError(function (_ref) {
let error = _ref.error;

handleError(error);
});

Expand Down
4 changes: 2 additions & 2 deletions src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function _exec(command, args, opts, isNode) {
return new Promise((resolve, reject) => {
const data = { stdout: [], stderr: [] }
const handleError = error => {
if (error.code === 'EACCES' || error.message.indexOf(COMMAND_NOT_RECOGNIZED_MESSAGE) !== -1) {
if (error.code === 'EACCES' || (error.message && error.message.indexOf(COMMAND_NOT_RECOGNIZED_MESSAGE) !== -1)) {
const newError = new Error(`Failed to spawn command '${command}'.` +
` Make sure it's a file, not a directory, and it's executable.`)
newError.name = 'BufferedProcessError'
Expand Down Expand Up @@ -71,7 +71,7 @@ function _exec(command, args, opts, isNode) {
new BufferedNodeProcess(parameters) :
new BufferedProcess(parameters)

spawnedProcess.onWillThrowError(error => {
spawnedProcess.onWillThrowError(({error}) => {
handleError(error)
})

Expand Down

0 comments on commit 8c6e445

Please sign in to comment.