UNPKG

493 BJavaScriptView Raw
1'use strict'
2
3const { Writable } = require('stream')
4
5function polyfill () {
6 if (!process.stdout) {
7 process.stdout = new Writable({
8 write (chunks, encoding, cb) {
9 console.log(chunks.toString('utf-8'))
10 process.nextTick(cb)
11 }
12 })
13 }
14
15 if (!process.stderr) {
16 process.stderr = new Writable({
17 write (chunks, encoding, cb) {
18 console.error(chunks.toString('utf-8'))
19 process.nextTick(cb)
20 }
21 })
22 }
23}
24
25module.exports = polyfill