Skip to content

Commit f4ec490

Browse files
committed
Update index.js
1 parent 3c69935 commit f4ec490

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

index.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ export const spawning = Sys.spawning = function (command, argument, progressOpti
194194
if (isFunction(options.onprogress))
195195
progress = options.onprogress;
196196

197-
let err = null;
197+
let error = null;
198198
let output = null;
199199
let sudo = options.sudo || false;
200200
let onerror = options.onerror || null;
@@ -220,7 +220,7 @@ export const spawning = Sys.spawning = function (command, argument, progressOpti
220220
return resolve(output);
221221
}
222222

223-
return reject(err, code);
223+
return reject(error, code);
224224
});
225225

226226
child.on('exit', () => {
@@ -251,12 +251,12 @@ export const spawning = Sys.spawning = function (command, argument, progressOpti
251251
});
252252

253253
child.stderr.on('data', (data) => {
254-
err = data.toString();
255-
if (isFunction(onerror)) {
256-
err = onerror(err);
257-
}
258-
259-
return reject(err);
254+
let err = data.toString();
255+
if (isFunction(onerror))
256+
/* c8 ignore next */
257+
error = onerror(err) || err;
258+
else
259+
error += err;
260260
});
261261
/*
262262
child.on('message', (data) => {

0 commit comments

Comments
 (0)