Browse Source

test: add test for SIGWINCH handling by stdio.js

PR-URL: https://github.com/nodejs/node/pull/10063
Reviewed-By: James M Snell <jasnell@gmail.com>
v4.x
Sarah Meyer 8 years ago
committed by Myles Borins
parent
commit
7020e9fd8b
No known key found for this signature in database GPG Key ID: 933B01F40B5CA946
  1. 29
      test/pseudo-tty/test-stderr-stdout-handle-sigwinch.js
  2. 2
      test/pseudo-tty/test-stderr-stdout-handle-sigwinch.out

29
test/pseudo-tty/test-stderr-stdout-handle-sigwinch.js

@ -0,0 +1,29 @@
'use strict';
const common = require('../common');
const originalRefreshSizeStderr = process.stderr._refreshSize;
const originalRefreshSizeStdout = process.stdout._refreshSize;
const wrap = (fn, ioStream, string) => {
return () => {
// The console.log() call prints a string that is in the .out file. In other
// words, the console.log() is part of the test, not extraneous debugging.
console.log(string);
try {
fn.call(ioStream);
} catch (e) {
// EINVAL happens on SmartOS if emulation is incomplete
if (!common.isSunOS || e.code !== 'EINVAL')
throw e;
}
};
};
process.stderr._refreshSize = wrap(originalRefreshSizeStderr,
process.stderr,
'calling stderr._refreshSize');
process.stdout._refreshSize = wrap(originalRefreshSizeStdout,
process.stdout,
'calling stdout._refreshSize');
process.emit('SIGWINCH');

2
test/pseudo-tty/test-stderr-stdout-handle-sigwinch.out

@ -0,0 +1,2 @@
calling stdout._refreshSize
calling stderr._refreshSize
Loading…
Cancel
Save