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 7020e9f

Browse filesBrowse files
sarahmeyerMylesBorins
authored andcommitted
test: add test for SIGWINCH handling by stdio.js
PR-URL: #10063 Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 7505b86 commit 7020e9f
Copy full SHA for 7020e9f

File tree

Expand file treeCollapse file tree

2 files changed

+31
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+31
-0
lines changed
Open diff view settings
Collapse file
+29Lines changed: 29 additions & 0 deletions
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');
Collapse file
+2Lines changed: 2 additions & 0 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.