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

@std/io: readAllSync only reads a single line from Deno.stdin when stdin is interactive #6346

Open
frou opened this issue Jan 14, 2025 · 0 comments
Labels
bug Something isn't working needs triage

Comments

@frou
Copy link

frou commented Jan 14, 2025

https://jsr.io/@std/io/doc/~/readAllSync

Steps to Reproduce

#!/usr/bin/env deno run

import { readAllSync } from "@std/io"

const content = readAllSync(Deno.stdin)

console.log()
console.log(content.length)

Expected behavior

When running the above script in a shell session, I'd expect to be able to do the following (typing 3 lines then pressing Ctrl-D (i.e. EOF) to finish):

$ ./repro.ts
one
two
three
^D

14
$

That is how all the other languages I've tried work.

Describe the bug

But readAllSync returns after I type the first line.

$ ./repro.ts
one

4
$

Environment

  • OS: macOS 12.7.6
  • deno version: 2.1.5
  • std version: 0.225.0
@frou frou added bug Something isn't working needs triage labels Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

1 participant