Odin
Odin copied to clipboard
[core:os] os.Stream does not return read errors
I'm having problems with the following code:
package main
import "core:bytes"
import "core:os"
import "core:io"
main :: proc() {
buf: bytes.Buffer
fh, _ := os.open("test.txt")
s := os.stream_from_handle(fh)
rd, _ := io.to_reader(s)
bytes.buffer_read_from(&buf, rd)
}
buffer_read_from
has a loop that uses an error check as it's escape condition, however os.Stream ignores all errors so the loop hangs the program. It would be very convenient to have buffer_read_from
working properly.