Commit 7793c36
child_process: flush consuming streams
When a client calls read() with a nonzero argument
on a Socket, that Socket sets this._consuming to true.
It never sets this._consuming back to false.
ChildProcess.flushStdio() currently doesn't flush
any streams where _consuming is truthy. But, that means
that it never flushes any stream that has ever been read from.
This prevents a child process from ever closing if one of
its streams has been read from, causing issue #4049. This
commit allows consuming streams to be flushed, and the
child process to emit a close event.
Fixes: #4049
PR-URL: #4071
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>1 parent 22b0971 commit 7793c36Copy full SHA for 7793c36
File tree
Expand file treeCollapse file tree
2 files changed
+18
-1
lines changedOpen diff view settings
Filter options
- lib/internal
- test/parallel
Expand file treeCollapse file tree
2 files changed
+18
-1
lines changedOpen diff view settings
Collapse file
lib/internal/child_process.js
Copy file name to clipboardExpand all lines: lib/internal/child_process.js+1-1Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
217 | 217 | |
218 | 218 | |
219 | 219 | |
220 | | - |
| 220 | + |
221 | 221 | |
222 | 222 | |
223 | 223 | |
|
Collapse file
test/parallel/test-child-process-flush-stdio.js
Copy file name to clipboard+17Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
0 commit comments