'process.stdout cannot be closed': process.stdout should behave like a standard stream
- Version: latest
- Platform: all
- Subsystem: node/lib/internal/process/stdio.js
sample code:
// hang process setTimeout(function(){}, 9999999) // in heavy development, there usually exists something that hangs the process. // we use 'process.exit' to solve this quickly. var stream = require('stream') process.stdin .pipe(new stream.PassThrough()) // there can be a list of Transform .pipe(new stream.PassThrough()) // there can be a list of Transform .pipe(new stream.PassThrough()) // there can be a list of Transform .on('end', function() { // process.exit() // exit here will stop stdout from flushing }) .pipe(process.stdout) .on('finish', function() { // this event will not trigger process.exit() })
execution result: hangs forever
expect: process.stdout should behaves like a standard stream.