Skip to content

process.stdin example from docs no longer works in node 10 #20503

Description

@apieceofbart

I am running process.stdin example from docs:

process.stdin.setEncoding('utf8');

process.stdin.on('readable', () => {
  const chunk = process.stdin.read();
  if (chunk !== null) {
    process.stdout.write(`data: ${chunk}`);
  }
});

process.stdin.on('end', () => {
  process.stdout.write('end');
});

I expect the same results as in node v9 and below: command line should wait for my input and return it prefixed with data: . Instead, process is closed right away. I believe this is regression as example works fine in node v9 and v8.

(edited by @addaleax: syntax highlighting)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues and PRs for confirmed bugs.processIssues and PRs related to the process subsystem.streamIssues and PRs related to Node.js streams.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions