Open paperdave opened 1 year ago
extra note: works with Bun.file("/dev/stdin").stream().getReader()
but not Bun.file(0).stream().getReader()
I don't think this is a bug
Closing the stdin file descriptor is a very destructive action. It should basically only happen when the application is closing
await Bun.stdin.text()
also never returns making it functionally useless, which is frustrating. I suspect it shares a root cause with this bug.
extra note: works with
Bun.file("/dev/stdin").stream().getReader()
but notBun.file(0).stream().getReader()
Mentioning Bun.file()
helps here https://github.com/oven-sh/bun/issues/11553#issuecomment-2146578443. And I suspect here https://github.com/oven-sh/bun/issues/8695.
Bun.stdin.stream()
does not work as expected, consistently hangs on 983036
bytes in async iteration where 1048576
are expected.
Bun.file(0).stream()
behaves the same as Bun.stdin.stream()
, yielding 983036
of 1048576
bytes expected.
That was not the case as recently as this commit https://github.com/guest271314/NativeMessagingHosts/commit/4878edcb14401d3f2b5aac08448f8e0f0916956, Feb 16 of this year.
Bun.file("/dev/stdin").stream()
and Bun.file("/proc/self/fd/0").stream()
do work as expected.
if (runtime.startsWith("Bun")) {
// Doesn't work
// readable = Bun.stdin.stream();
// readable = Bun.file(0).stream();
// Works
// readable = Bun.file("/dev/stdin").stream();
readable = Bun.file("/proc/self/fd/0").stream();
writable = new WritableStream({
async write(value) {
await Bun.write(Bun.stdout, value);
},
}, new CountQueuingStrategy({ highWaterMark: Infinity }));
({ exit } = process);
({ argv: args } = Bun);
}
@guest271314 Sounds like a different bug, if it originated after this bug was created.
The behavior I was experiencing no longer occurs.
Alright. This is as close to what I am reproducing. I searched before reporting documentation and runtime issues. Bun.stdin.stream()
stops reading consistently at 983036
. Thanks.
What version of Bun is running?
No response
What platform is your computer?
No response
What steps can reproduce the bug?
run and press ctrl+d. should print Exiting... and exit. on bun, it doesn't do anything and the shell prints
^D
What is the expected behavior?
No response
What do you see instead?
No response
Additional information
This is related to #2333 and #1873. Opening a separate issue for specifically using
Bun.stdin
on it's own instead of how it acts in readline, but this might fix the other bugs.