mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
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: https://github.com/nodejs/node/issues/16141 Fixes: https://github.com/nodejs/node/issues/16194 PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
parent
6c76140a7a
commit
9c1b18a59f
2
lib/internal/bootstrap_node.js
vendored
2
lib/internal/bootstrap_node.js
vendored
@ -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();
|
||||
@ -55,7 +56,6 @@
|
||||
_process.setup_cpuUsage();
|
||||
_process.setupMemoryUsage();
|
||||
_process.setupKillAndExit();
|
||||
_process.setupSignalHandlers();
|
||||
if (global.__coverage__)
|
||||
NativeModule.require('internal/process/write-coverage').setup();
|
||||
|
||||
|
@ -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
test/pseudo-tty/test-tty-stdout-resize.js
Normal file
11
test/pseudo-tty/test-tty-stdout-resize.js
Normal file
@ -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)));
|
0
test/pseudo-tty/test-tty-stdout-resize.out
Normal file
0
test/pseudo-tty/test-tty-stdout-resize.out
Normal file
Loading…
Reference in New Issue
Block a user