UNPKG

445 BJavaScriptView Raw
1'use strict'
2
3/**
4 * 强制 stdio 同步输出
5 * https://github.com/nodejs/node/issues/6456
6 *
7 * @param {boolean} blocking 是否同步
8 * @returns {void}
9 */
10function setBlocking (blocking) {
11 [process.stdout, process.stderr].forEach(stream => {
12 /* istanbul ignore else */
13 if (stream._handle && typeof stream._handle.setBlocking === 'function') {
14 stream._handle.setBlocking(blocking)
15 }
16 })
17}
18
19module.exports = setBlocking