• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../common');
3
4const originalRefreshSizeStderr = process.stderr._refreshSize;
5const originalRefreshSizeStdout = process.stdout._refreshSize;
6
7const wrap = (fn, ioStream, string) => {
8  const wrapped = common.mustCall(() => {
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  return wrapped;
21};
22
23process.stderr._refreshSize = wrap(originalRefreshSizeStderr,
24                                   process.stderr,
25                                   'calling stderr._refreshSize');
26process.stdout._refreshSize = wrap(originalRefreshSizeStdout,
27                                   process.stdout,
28                                   'calling stdout._refreshSize');
29
30// In AIX, the child exits even before the python parent
31// can setup the readloop. Provide a reasonable delay.
32setTimeout(function() {
33  process.emit('SIGWINCH');
34}, common.isAIX ? 200 : 0);
35