Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f321921

Browse filesBrowse files
bnoordhuisMylesBorins
authored andcommitted
tty: fix 'resize' event regression
It's not wholly clear what commit introduced the regression but between v8.4.0 and v8.5.0 the 'resize' event stopped getting emitted when the tty was resized. The SIGWINCH event listener apparently was being installed before the support code for `process.on('SIGWINCH', ...)` was. Fix that by moving said support code to real early in the bootstrap process. This commit also seems to fix a Windows-only "write EINVAL" error for reasons even less well-understood... Fixes: #16141 Fixes: #16194 PR-URL: #16225 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
1 parent 7ac760b commit f321921
Copy full SHA for f321921

File tree

Expand file treeCollapse file tree

4 files changed

+17
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

4 files changed

+17
-1
lines changed
Open diff view settings
Collapse file

‎lib/internal/bootstrap_node.js‎

Copy file name to clipboardExpand all lines: lib/internal/bootstrap_node.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
const _process = NativeModule.require('internal/process');
3535
_process.setupConfig(NativeModule._source);
36+
_process.setupSignalHandlers();
3637
NativeModule.require('internal/process/warning').setup();
3738
NativeModule.require('internal/process/next_tick').setup();
3839
NativeModule.require('internal/process/stdio').setup();
@@ -55,7 +56,6 @@
5556
_process.setup_cpuUsage();
5657
_process.setupMemoryUsage();
5758
_process.setupKillAndExit();
58-
_process.setupSignalHandlers();
5959
if (global.__coverage__)
6060
NativeModule.require('internal/process/write-coverage').setup();
6161

Collapse file

‎test/pseudo-tty/pseudo-tty.status‎

Copy file name to clipboardExpand all lines: test/pseudo-tty/pseudo-tty.status
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,8 @@ prefix pseudo-tty
33
[$system==aix]
44
# being investigated under https://github.com/nodejs/node/issues/9728
55
test-tty-wrap : FAIL, PASS
6+
7+
[$system==solaris]
8+
# https://github.com/nodejs/node/pull/16225 - `ioctl(fd, TIOCGWINSZ)` seems
9+
# to fail with EINVAL on SmartOS when `fd` is a pty from python's pty module.
10+
test-tty-stdout-resize : FAIL, PASS
Collapse file
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
'use strict';
2+
const { mustCall } = require('../common');
3+
const { notStrictEqual } = require('assert');
4+
5+
// tty.WriteStream#_refreshSize() only emits the 'resize' event when the
6+
// window dimensions change. We cannot influence that from the script
7+
// but we can set the old values to something exceedingly unlikely.
8+
process.stdout.columns = 9001;
9+
process.stdout.on('resize', mustCall());
10+
process.kill(process.pid, 'SIGWINCH');
11+
setImmediate(mustCall(() => notStrictEqual(process.stdout.columns, 9001)));
Collapse file

‎test/pseudo-tty/test-tty-stdout-resize.out‎

Copy file name to clipboardExpand all lines: test/pseudo-tty/test-tty-stdout-resize.out
Whitespace-only changes.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.