You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug A clear and concise description of what the bug is.
it seems Deno's readLines always yield empty "" at EOF, while all other known Programming languages' similar line scanning interfaces don't do this
import{readLines}from"https://deno.land/[email protected]/io/mod.ts";forawait(constlineofreadLines(Deno.stdin)){console.log(newDate,'got line:',{ line });}
funcmain() {
scanner:=bufio.NewScanner(os.Stdin)
forscanner.Scan() {
fmt.Println(scanner.Text()) // Println will add back the final '\n'
}
iferr:=scanner.Err(); err!=nil {
fmt.Fprintln(os.Stderr, "reading standard input:", err)
}
}
$ seq 3 | ./readlines-go
1
2
3
and Python:
$ seq 3 | python -c 'import sys;for line in sys.stdin: print("line:", line)'
('line:', '1\n')
('line:', '2\n')
('line:', '3\n')
The text was updated successfully, but these errors were encountered:
Describe the bug A clear and concise description of what the bug is.
it seems Deno's
readLines
always yield empty "" at EOF, while all other known Programming languages' similar line scanning interfaces don't do thisTo Reproduce Steps to reproduce the behavior:
Expected behavior A clear and concise description of what you expected to
happen.
Node's builtin
readline
::Go's example scanner lines https://golang.org/pkg/bufio/#example_Scanner_lines
$ seq 3 | ./readlines-go 1 2 3
and Python:
The text was updated successfully, but these errors were encountered: