mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Correct os.read on windows for os.stdin
This commit is contained in:
@@ -108,7 +108,8 @@ read_console :: proc(handle: win32.HANDLE, b: []byte) -> (n: int, err: Errno) {
|
|||||||
buf8: [4*BUF_SIZE]u8
|
buf8: [4*BUF_SIZE]u8
|
||||||
|
|
||||||
for n < len(b) && err == 0 {
|
for n < len(b) && err == 0 {
|
||||||
max_read := u32(min(BUF_SIZE, len(b)/4))
|
min_read := max(min(len(b), 4), len(b)/4)
|
||||||
|
max_read := u32(min(BUF_SIZE, min_read))
|
||||||
|
|
||||||
single_read_length: u32
|
single_read_length: u32
|
||||||
ok := win32.ReadConsoleW(handle, &buf16[0], max_read, &single_read_length, nil)
|
ok := win32.ReadConsoleW(handle, &buf16[0], max_read, &single_read_length, nil)
|
||||||
@@ -129,7 +130,7 @@ read_console :: proc(handle: win32.HANDLE, b: []byte) -> (n: int, err: Errno) {
|
|||||||
b[n] = x
|
b[n] = x
|
||||||
n += 1
|
n += 1
|
||||||
}
|
}
|
||||||
if ctrl_z || single_read_length < len(buf16) {
|
if ctrl_z || single_read_length < max_read {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user