- Version:
v8.4.0 - Platform:
Darwin duplo 15.6.0 Darwin Kernel Version 15.6.0: Tue Apr 11 16:00:51 PDT 2017; root:xnu-3248.60.11.5.3~1/RELEASE_X86_64 x86_64 - Subsystem: net, stream or child_process (?)
Tested with:
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin15)GNU bash, version 4.2.25(1)-release (x86_64-pc-linux-gnu)
Not sure is this the same or another bug but in my environment it throws:
Error: write EPIPE
at _errnoException (util.js:1041:11)
at WriteWrap.afterWrite [as oncomplete] (net.js:858:14)
But when we played with it a little:
Error: This socket has been ended by the other party
at Socket.writeAfterFIN [as write] (net.js:352:12)
at __dirname (/Users/qfox/repos/trendbox-ci/omg.js:11:11)
at <anonymous>
How to repro:
const{ spawn }=require('child_process');constpause=t=>newPromise(resolve=>setTimeout(resolve,t));const{ stdin }=spawn('bash',[/*'-i'*/],{stdio: ['pipe','inherit']});(async()=>{stdin.write('echo All is fine here\n');awaitpause(200);stdin.write('node -e process.stdin && echo After process.stdin\n');awaitpause(2000);// It's important: the bigger pause, the more frequently occursstdin.write('echo After all\n');})().catch(e=>console.error(e.stack));If we remove usage of process.stdin or force shell to be interactive (pass in ['-i'] flag) or just call node -e process.stdin with </dev/stdin — then the problem disappears.
Would be nice to have a good error message if it's unfixable ;'-(
upd:
See also: #947, #2339, #13278
v8.4.0Darwin duplo 15.6.0 Darwin Kernel Version 15.6.0: Tue Apr 11 16:00:51 PDT 2017; root:xnu-3248.60.11.5.3~1/RELEASE_X86_64 x86_64Tested with:
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin15)GNU bash, version 4.2.25(1)-release (x86_64-pc-linux-gnu)Not sure is this the same or another bug but in my environment it throws:
But when we played with it a little:
How to repro:
If we remove usage of
process.stdinor force shell to be interactive (pass in['-i']flag) or just callnode -e process.stdinwith</dev/stdin— then the problem disappears.Would be nice to have a good error message if it's unfixable ;'-(
upd:
See also: #947, #2339, #13278