Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPIPE thrown when calling process.stdin.end() in node 10.15.3 on Windows #26828

Closed
barakman opened this issue Mar 20, 2019 · 6 comments
Closed
Labels
windows Issues and PRs related to the Windows platform.

Comments

@barakman
Copy link

barakman commented Mar 20, 2019

System:

  • Version: v10.15.3
  • Platform: Windows 10 64-bit

Code:

process.stdout.write("Enter input: ");
process.stdin.on("data", function(data) {
    process.stdin.end();
});

Error:

events.js:174
      throw er; // Unhandled 'error' event
      ^

Error: shutdown EPIPE
    at ReadStream.Socket._final (net.js:361:25)
    at callFinal (_stream_writable.js:612:10)
    at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
    at emitErrorNT (internal/streams/destroy.js:82:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)

Notes:


Alternative solution 1 (as suggested in the issue linked above):

process.stdout.write("Enter input: ");
process.stdin.on("data", function(data) {
    process.stdin.destroy();
});

Alternative solution 2 (my preferred method):

process.stdout.write("Enter input: ");
process.stdin.resume();
process.stdin.once("data", function(data) {
    process.stdin.pause();
});

Alternative solution 3 (handle the 'error' event):

process.stdout.write("Enter input: ");
process.stdin.on("data", function(data) {
    process.stdin.end();
}).on("error", function(error) {
    console.log(error.message); // shutdown EPIPE
});
barakman added a commit to bancorprotocol/contracts-solidity that referenced this issue Mar 20, 2019
Due to a problem in NodeJS v10.15.3, fix the input-reading in script `run-tests.js`.
See nodejs/node#26828.
@bzoz
Copy link
Contributor

bzoz commented Mar 21, 2019

Can reproduce. Simply calling node -e process.stdin.end() produces EPIPE.

/cc @nodejs/platform-windows

@sam-github sam-github added the windows Issues and PRs related to the Windows platform. label Mar 21, 2019
@sam-github sam-github changed the title EPIPE thrown when calling process.stdin.end() in node 10.15.3 EPIPE thrown when calling process.stdin.end() in node 10.15.3 on Windows Mar 21, 2019
@sam-github
Copy link
Contributor

But not on linux, so I labelled as Windows

@HarshithaKP
Copy link
Member

@barakman, Is it still an issue for you ?. I am able to reproduce this and it is fixed in v12.13.1

@bzoz
Copy link
Contributor

bzoz commented Mar 31, 2020

Fixed in v13 and v12, but still an issue on v10.19.0

@richardlau
Copy link
Member

Fixed in v13 and v12, but still an issue on v10.19.0

Any chance you could try the proposed 10.20.0 (#31984) as it brings 10.x up to a more recent libuv: https://nodejs.org/download/rc/v10.20.0-rc.1/

@bzoz
Copy link
Contributor

bzoz commented Mar 31, 2020

Yep, fixed in 10.20.0.

@bzoz bzoz closed this as completed Mar 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

No branches or pull requests

5 participants