Skip to content

Commit 5164b56

Browse files
sarahmeyerevanlucas
authored andcommitted
test: add test for SIGWINCH handling by stdio.js
PR-URL: #10063 Reviewed-By: James M Snell <[email protected]>
1 parent 1aa3ab1 commit 5164b56

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
'use strict';
2+
const common = require('../common');
3+
4+
const originalRefreshSizeStderr = process.stderr._refreshSize;
5+
const originalRefreshSizeStdout = process.stdout._refreshSize;
6+
7+
const wrap = (fn, ioStream, string) => {
8+
return () => {
9+
// The console.log() call prints a string that is in the .out file. In other
10+
// words, the console.log() is part of the test, not extraneous debugging.
11+
console.log(string);
12+
try {
13+
fn.call(ioStream);
14+
} catch (e) {
15+
// EINVAL happens on SmartOS if emulation is incomplete
16+
if (!common.isSunOS || e.code !== 'EINVAL')
17+
throw e;
18+
}
19+
};
20+
};
21+
22+
process.stderr._refreshSize = wrap(originalRefreshSizeStderr,
23+
process.stderr,
24+
'calling stderr._refreshSize');
25+
process.stdout._refreshSize = wrap(originalRefreshSizeStdout,
26+
process.stdout,
27+
'calling stdout._refreshSize');
28+
29+
process.emit('SIGWINCH');
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
calling stdout._refreshSize
2+
calling stderr._refreshSize

0 commit comments

Comments
 (0)