Skip to content

Commit

Permalink
child_process: simplify send() result handling
Browse files Browse the repository at this point in the history
PR-URL: #13459
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
  • Loading branch information
mscdex authored and addaleax committed Jun 10, 2017
1 parent f134c9d commit d1fa59f
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lib/internal/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -645,16 +645,15 @@ function setupChannel(target, channel) {
obj.postSend(handle, options, target);
}

req.oncomplete = function() {
if (this.async === true)
if (req.async) {
req.oncomplete = function() {
control.unref();
if (typeof callback === 'function')
callback(null);
};
if (req.async === true) {
if (typeof callback === 'function')
callback(null);
};
control.ref();
} else {
process.nextTick(function() { req.oncomplete(); });
} else if (typeof callback === 'function') {
process.nextTick(callback, null);
}
} else {
// Cleanup handle on error
Expand Down

0 comments on commit d1fa59f

Please sign in to comment.