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

tty: fix 'resize' event regression #16225

Merged
merged 1 commit into from
Nov 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/internal/bootstrap_node.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

const _process = NativeModule.require('internal/process');
_process.setupConfig(NativeModule._source);
_process.setupSignalHandlers();
NativeModule.require('internal/process/warning').setup();
NativeModule.require('internal/process/next_tick').setup();
NativeModule.require('internal/process/stdio').setup();
Expand All @@ -55,7 +56,6 @@
_process.setup_cpuUsage();
_process.setupMemoryUsage();
_process.setupKillAndExit();
_process.setupSignalHandlers();
if (global.__coverage__)
NativeModule.require('internal/process/write-coverage').setup();

Expand Down
5 changes: 5 additions & 0 deletions test/pseudo-tty/pseudo-tty.status
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ prefix pseudo-tty
[$system==aix]
# being investigated under https://github.com/nodejs/node/issues/9728
test-tty-wrap : FAIL, PASS

[$system==solaris]
# https://github.com/nodejs/node/pull/16225 - `ioctl(fd, TIOCGWINSZ)` seems
# to fail with EINVAL on SmartOS when `fd` is a pty from python's pty module.
test-tty-stdout-resize : FAIL, PASS
11 changes: 11 additions & 0 deletions test/pseudo-tty/test-tty-stdout-resize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict';
const { mustCall } = require('../common');
const { notStrictEqual } = require('assert');

// tty.WriteStream#_refreshSize() only emits the 'resize' event when the
// window dimensions change. We cannot influence that from the script
// but we can set the old values to something exceedingly unlikely.
process.stdout.columns = 9001;
process.stdout.on('resize', mustCall());
process.kill(process.pid, 'SIGWINCH');
setImmediate(mustCall(() => notStrictEqual(process.stdout.columns, 9001)));
Copy link
Member

Choose a reason for hiding this comment

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

Nit: it doesn't harm but I think mustCall() is useless here.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's there in case a bug makes the immediate not run. Since this PR touches early-boot code it seems like a good extra sanity check

Empty file.