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

nodejs handle process.stdin incorrect #442

Open
image72 opened this issue Jul 28, 2023 · 1 comment
Open

nodejs handle process.stdin incorrect #442

image72 opened this issue Jul 28, 2023 · 1 comment

Comments

@image72
Copy link

image72 commented Jul 28, 2023

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));
})()
@image72
Copy link
Author

image72 commented Jul 28, 2023

node -v
v18.17.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant