Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d1fa59f

Browse filesBrowse files
mscdexaddaleax
authored andcommitted
child_process: simplify send() result handling
PR-URL: #13459 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
1 parent f134c9d commit d1fa59f
Copy full SHA for d1fa59f

File tree

Expand file treeCollapse file tree

1 file changed

+7
-8
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-8
lines changed
Open diff view settings
Collapse file

‎lib/internal/child_process.js‎

Copy file name to clipboardExpand all lines: lib/internal/child_process.js
+7-8Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -645,16 +645,15 @@ function setupChannel(target, channel) {
645645
obj.postSend(handle, options, target);
646646
}
647647

648-
req.oncomplete = function() {
649-
if (this.async === true)
648+
if (req.async) {
649+
req.oncomplete = function() {
650650
control.unref();
651-
if (typeof callback === 'function')
652-
callback(null);
653-
};
654-
if (req.async === true) {
651+
if (typeof callback === 'function')
652+
callback(null);
653+
};
655654
control.ref();
656-
} else {
657-
process.nextTick(function() { req.oncomplete(); });
655+
} else if (typeof callback === 'function') {
656+
process.nextTick(callback, null);
658657
}
659658
} else {
660659
// Cleanup handle on error

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.