We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f134c9d commit d1fa59fCopy full SHA for d1fa59f
lib/internal/child_process.js
@@ -645,16 +645,15 @@ function setupChannel(target, channel) {
645
obj.postSend(handle, options, target);
646
}
647
648
- req.oncomplete = function() {
649
- if (this.async === true)
+ if (req.async) {
+ req.oncomplete = function() {
650
control.unref();
651
- if (typeof callback === 'function')
652
- callback(null);
653
- };
654
- if (req.async === true) {
+ if (typeof callback === 'function')
+ callback(null);
+ };
655
control.ref();
656
- } else {
657
- process.nextTick(function() { req.oncomplete(); });
+ } else if (typeof callback === 'function') {
+ process.nextTick(callback, null);
658
659
} else {
660
// Cleanup handle on error
0 commit comments