Skip to content
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

Merged
merged 1 commit into from Jul 23, 2015

Conversation

Fishrock123
Copy link
Member

Fixes: #2219

I'd consider this a patch level thing, but it could possibly be considered semver-minor; does anyone have opinions about that?

@Fishrock123 Fishrock123 added the process Issues and PRs related to the process subsystem. label Jul 23, 2015
@cjihrig
Copy link
Contributor

cjihrig commented Jul 23, 2015

LGTM. I'd say it's definitely a bug fix.

@bnoordhuis
Copy link
Member

LGTM and I agree with @cjihrig.

@thefourtheye
Copy link
Contributor

LGTMT

process.on('SIGWINCH', function() {
stdout._refreshSize();
});
process.on('SIGWINCH', stdout._refreshSize);
Copy link
Member

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good catch.

Copy link
Member Author

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?

Copy link
Contributor

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.

Copy link
Member

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doh. Right. Javascript.

@Fishrock123 Fishrock123 force-pushed the stderr-resize branch 2 times, most recently from e35c4a4 to 1b381e2 Compare July 23, 2015 19:26
@Fishrock123
Copy link
Member Author

@targos fixed, PTAL

@targos
Copy link
Member

targos commented Jul 23, 2015

LGTM

Fixes: nodejs#2219
PR-URL: nodejs#2231
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
process Issues and PRs related to the process subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants