Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 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
33 changes: 33 additions & 0 deletions test/pseudo-tty/test-stderr-stdout-handle-sigwinch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
'use strict';
const common = require('../common');

// if printing, add to out file
const originalRefreshSizeWrapperStderr = process.stderr._refreshSize;
const originalRefreshSizeWrapperStdout = process.stdout._refreshSize;

const refreshSizeWrapperStderr = () => {
console.log('calling stderr._refreshSize');
try {
originalRefreshSizeWrapperStderr.call(process.stderr);
} catch (e) {
// EINVAL happens on SmartOS if emulation is incomplete
if (!common.isSunOS || e.code !== 'EINVAL')
throw e;
}
};

const refreshSizeWrapperStdout = () => {
console.log('calling 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.

A comment indicating that the console.log is part of the test would be helpful.

Copy link
Member

Choose a reason for hiding this comment

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

Sure, done. Will run Ci again because there was some refactoring that accompanied it.

try {
originalRefreshSizeWrapperStdout.call(process.stdout);
} catch (e) {
// EINVAL happens on SmartOS if emulation is incomplete
if (!common.isSunOS || e.code !== 'EINVAL')
throw e;
}
};

process.stderr._refreshSize = refreshSizeWrapperStderr;
process.stdout._refreshSize = refreshSizeWrapperStdout;

process.emit('SIGWINCH');
2 changes: 2 additions & 0 deletions test/pseudo-tty/test-stderr-stdout-handle-sigwinch.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
calling stdout._refreshSize
calling stderr._refreshSize