diff options
author | Sarah Meyer <sarahsaltrick@gmail.com> | 2016-12-01 12:03:48 -0600 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2016-12-27 21:21:35 -0800 |
commit | a9b59ff8fbcef8af4aad202d9e475e86e066f821 (patch) | |
tree | 8b9552dd8fb3c4045e781908c9173cc10e72ac73 /test/pseudo-tty/test-stderr-stdout-handle-sigwinch.js | |
parent | b85f9fec2fe3a3388f984052e8f1f218f6d7c1e6 (diff) | |
download | android-node-v8-a9b59ff8fbcef8af4aad202d9e475e86e066f821.tar.gz android-node-v8-a9b59ff8fbcef8af4aad202d9e475e86e066f821.tar.bz2 android-node-v8-a9b59ff8fbcef8af4aad202d9e475e86e066f821.zip |
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>
Diffstat (limited to 'test/pseudo-tty/test-stderr-stdout-handle-sigwinch.js')
-rw-r--r-- | test/pseudo-tty/test-stderr-stdout-handle-sigwinch.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/pseudo-tty/test-stderr-stdout-handle-sigwinch.js b/test/pseudo-tty/test-stderr-stdout-handle-sigwinch.js new file mode 100644 index 0000000000..f1a95559b9 --- /dev/null +++ b/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'); |