Skip to content

Commit

Permalink
test: require handler to be run in sigwinch test
Browse files Browse the repository at this point in the history
Use `common.mustCall()` to guarantee that the wrapped `_refreshSize()`
functions are invoked.

PR-URL: #11068
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michal Zasso <targos@protonmail.com>
  • Loading branch information
Trott authored and evanlucas committed Jan 31, 2017
1 parent 84a9c15 commit 8ef4add
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/pseudo-tty/test-stderr-stdout-handle-sigwinch.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const originalRefreshSizeStderr = process.stderr._refreshSize;
const originalRefreshSizeStdout = process.stdout._refreshSize;

const wrap = (fn, ioStream, string) => {
return () => {
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);
Expand All @@ -16,7 +16,8 @@ const wrap = (fn, ioStream, string) => {
if (!common.isSunOS || e.code !== 'EINVAL')
throw e;
}
};
});
return wrapped;
};

process.stderr._refreshSize = wrap(originalRefreshSizeStderr,
Expand Down

0 comments on commit 8ef4add

Please sign in to comment.