node/test/pseudo-tty/test-stderr-stdout-handle-sigwinch.js
章礼平 fb37922cf3 test: change isAix to isAIX
This makes the naming more consistent with existing properties like
isFreeBSD where the capitalization of the property name is consistent
with the conventional styling of the operating system.

PR-URL: https://github.com/nodejs/node/pull/14263
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Bryan English <bryan@bryanenglish.com>
2017-07-16 02:24:47 -07:00

35 lines
1.2 KiB
JavaScript

'use strict';
const common = require('../common');
const originalRefreshSizeStderr = process.stderr._refreshSize;
const originalRefreshSizeStdout = process.stdout._refreshSize;
const wrap = (fn, ioStream, string) => {
const wrapped = common.mustCall(() => {
// 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;
}
});
return wrapped;
};
process.stderr._refreshSize = wrap(originalRefreshSizeStderr,
process.stderr,
'calling stderr._refreshSize');
process.stdout._refreshSize = wrap(originalRefreshSizeStdout,
process.stdout,
'calling stdout._refreshSize');
// In AIX, the child exits even before the python parent
// can setup the readloop. Provide a reasonable delay.
setTimeout(function() {
process.emit('SIGWINCH');
}, common.isAIX ? 200 : 0);