Skip to content

nodejs handle process.stdin incorrect #442

@image72

Description

@image72

Node.js read stdin synchronous

I tested above async read process.stdin.
in case code, echo 'hello world' | node stdin.js work correct.

but with websocketd --port 8058 ./mock3.js read std empty.

(async function () {
   const input = await readStdinSync();
  setInterval(() => {
    process.stdout.write(JSON.stringify({ now: +new Date(), text: data.trim() }) + '\n');
  }, (3000));
})()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions