-
Notifications
You must be signed in to change notification settings - Fork 30.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stream: change in stdout/stderr events from child process (missing finish
)
#19764
Comments
Analysis seems correct. The following patch is untested but should fix the issue: diff --git a/lib/net.js b/lib/net.js
index 5b460befa4..324f99804a 100644
--- a/lib/net.js
+++ b/lib/net.js
@@ -241,11 +241,11 @@ function Socket(options) {
this[kTimeout] = null;
if (typeof options === 'number')
- options = { fd: options }; // Legacy interface.
+ options = { allowHalfOpen: false, fd: options }; // Legacy interface.
else if (options === undefined)
- options = {};
+ options = { allowHalfOpen: false };
else
- options = util._extend({}, options);
+ options = util._extend({ allowHalfOpen: false }, options);
// For backwards compat do not emit close on destroy.
options.emitClose = false;
@@ -300,9 +300,6 @@ function Socket(options) {
// handle strings directly
this._writableState.decodeStrings = false;
- // default to *not* allowing half open sockets
- this.allowHalfOpen = options.allowHalfOpen || false;
-
// if we have a handle, then start the flow of data into the
// buffer. if not, then this will happen when we connect
if (this._handle && options.readable !== false) { I will test it properly and open a PR. |
On second thought I don't think it's 9c0c0e6 that caused the regression as this https://github.com/nodejs/node/blob/v9.9.0/lib/net.js#L613-L616 should call This needs a bisect. |
Ok, yes 9c0c0e6 is the first bad commit. The no-half-open enforcer was calling I think the changed behavior is actually a bug fix as calling Makes sense? |
If the `allowHalfOpen` option is not provided, use its default value before calling the `Duplex` constructor. This allows the no-half-open enforcer to be properly added. Fixes: nodejs#19764
Yes, I think you are correct in this behavior change is a bug fix. The change does better reflect documentation on streams as Thank you for divining into this so quickly! |
I believe commit 9c0c0e68ac introduced a breaking change to what events are emitted from child process streams stdout/stderr.
In node v9.9.0
In node v9.8.0
Per the documentation,
finish
should only be associated with awritable
stream, so the current behavior in 9.9.0 seems to be accurate. Given that, I'm not sure if the previous behavior was a bug or not.The text was updated successfully, but these errors were encountered: