Repository navigation
Closed
Description
- Version: 10 (since libuv 1.20)
- Platform: all
- Subsystem: tty, net
This behavior is a regression caused by libuv (see libuv/libuv#1936 and #21654).
Currently:
process.stdin.write('hello')Throws
events.js:167
throw er; // Unhandled 'error' event
^
Error: write EPIPE
at afterWriteDispatched (internal/stream_base_commons.js:79:25)
at writeGeneric (internal/stream_base_commons.js:74:3)
at ReadStream.Socket._writeGeneric (net.js:715:5)
at ReadStream.Socket._write (net.js:727:8)
at doWrite (_stream_writable.js:410:12)
at writeOrBuffer (_stream_writable.js:394:5)
at ReadStream.Writable.write (_stream_writable.js:294:11)
at Object.<anonymous> (/Users/matteo/Repositories/node/a.js:1:77)
at Module._compile (internal/modules/cjs/loader.js:693:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:704:10)
Emitted 'error' event at:
at onwriteError (_stream_writable.js:425:12)
at onwrite (_stream_writable.js:456:5)
at _destroy (internal/streams/destroy.js:40:7)
at ReadStream.Socket._destroy (net.js:615:3)
at ReadStream.destroy (internal/streams/destroy.js:32:8)
at afterWriteDispatched (internal/stream_base_commons.js:79:17)
at writeGeneric (internal/stream_base_commons.js:74:3)
[... lines matching original stack trace ...]
at doWrite (_stream_writable.js:410:12)Is this error acceptable/understandable, or should we do a custom error like #21654?
Activity
mcollina commentedon Sep 17, 2018
cc @addaleax
addaleax commentedon Sep 17, 2018
I think it would be okay to keep this the way it is – if we do want to provide a better error message, we should probably create a custom one for
EPIPE? It’s weird that we don’t already include at leaststrerror(EPIPE)like we do for other errors…addaleax commentedon Sep 17, 2018
And, again, I think this is a bug – stdin could definitely be a duplex or writable stream. And
process.stdinmight be a sensible way to access the current TTY if stdout/stderr are redirected to some file but stdin isn’t.mcollina commentedon Sep 17, 2018
cc @cjihrig
mcollina commentedon Sep 17, 2018
I'm ok in keeping it the way it is now.
Trott commentedon Nov 24, 2018
Should this remain open or be closed?
addaleax commentedon Nov 24, 2018
As far as I can tell, this has actually been fixed (partially in libuv). → Closing!