Skip to content

Commit 88be986

Browse files
committed
feature(package) try-catch v2.0.0
1 parent ddcd614 commit 88be986

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

lib/spawnify.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ Spawnify.prototype._emit = function emit(event, data) {
117117

118118
Spawnify.prototype._set = function set(type, command, options) {
119119
let args, error, child;
120+
let result;
120121

121122
assert(type, 'event could not be empty!');
122123
assert(command, 'command could not be empty!');
@@ -129,9 +130,10 @@ Spawnify.prototype._set = function set(type, command, options) {
129130
throw(Error('type could be exec or spawn only!'));
130131

131132
case 'exec':
132-
error = tryCatch(() => {
133-
child = exec(command, options);
134-
});
133+
result = tryCatch(exec, command, options);
134+
135+
error = result[0];
136+
child = result[1];
135137
break;
136138

137139
case 'spawn':

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"dependencies": {
2323
"glob": "^7.1.0",
2424
"tildify": "^1.2.0",
25-
"try-catch": "^1.0.0",
25+
"try-catch": "^2.0.0",
2626
"untildify": "^3.0.2",
2727
"win32": "^1.0.0"
2828
},

0 commit comments

Comments
 (0)