Skip to content

Commit

Permalink
Add error handling when command not found
Browse files Browse the repository at this point in the history
  • Loading branch information
mnatsu31 committed Jan 28, 2016
1 parent 80dd29a commit 79b324b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/util/run.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,11 @@ describe('Utility: `run`', function () {
});
});

it('should handle error when the command could not be found', function (done) {
run('7zxxx a ".tmp/test/archive.7z" "*.exe" "*.dll"').catch(function (err) {
expect(err.message).to.eql('spawn 7zxxx ENOENT');
done();
});
});

});
3 changes: 3 additions & 0 deletions util/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ module.exports = function (command, switches) {
}
return progress(data.toString());
});
run.on('error', function (err) {
reject(err)
});
run.on('close', function (code) {
if (code === 0) {
return fulfill(args);
Expand Down

0 comments on commit 79b324b

Please sign in to comment.