Browse Source

child_process: simplify send() result handling

PR-URL: https://github.com/nodejs/node/pull/13459
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
v6
Brian White 8 years ago
parent
commit
dd83d11869
No known key found for this signature in database GPG Key ID: 606D7358F94DA209
  1. 15
      lib/internal/child_process.js

15
lib/internal/child_process.js

@ -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

Loading…
Cancel
Save