-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
process: resize stderr on SIGWINCH #2231
Conversation
LGTM. I'd say it's definitely a bug fix. |
LGTM and I agree with @cjihrig. |
LGTMT |
process.on('SIGWINCH', function() { | ||
stdout._refreshSize(); | ||
}); | ||
process.on('SIGWINCH', stdout._refreshSize); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure but it looks like this will fail if _refreshSize
needs to access this
Edit: that would explain why it was wrapped in a function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good catch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this
referring to the stream though? i.e. the stdout
or stderr
objects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Fishrock123 You might have to bind
. stdout._refreshSize.bind(stdout)
EDIT: The actual definition https://github.com/nodejs/io.js/blob/master/lib/tty.js#L76-92 uses this
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is supposed to, but in this case you are passing the method to the event emitter, without its context.
Result is the same as:
var obj = { method() { console.log(this) } };
obj.method(); // obj
var method = obj.method;
method(); // undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doh. Right. Javascript.
e35c4a4
to
1b381e2
Compare
@targos fixed, PTAL |
LGTM |
Fixes: nodejs#2219 PR-URL: nodejs#2231 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
1b381e2
to
bf2cd22
Compare
Fixes: #2219
I'd consider this a patch level thing, but it could possibly be considered semver-minor; does anyone have opinions about that?