fix os2.process_exec on non-windows and add a smoke test

This commit is contained in:
Laytan Laats
2024-10-03 13:51:27 +02:00
parent 0d834a2c2e
commit 76806080ef
4 changed files with 78 additions and 35 deletions
+5 -3
View File
@@ -49,7 +49,7 @@ _pipe_has_data :: proc(r: ^File) -> (ok: bool, err: Error) {
if r == nil || r.impl == nil {
return false, nil
}
fd := posix.FD((^File_Impl)(r.impl).fd)
fd := __fd(r)
poll_fds := []posix.pollfd {
posix.pollfd {
fd = fd,
@@ -57,8 +57,10 @@ _pipe_has_data :: proc(r: ^File) -> (ok: bool, err: Error) {
},
}
n := posix.poll(raw_data(poll_fds), u32(len(poll_fds)), 0)
if n != 1 {
if n < 0 {
return false, _get_platform_error()
} else if n != 1 {
return false, nil
}
pipe_events := poll_fds[0].revents
if pipe_events >= {.IN} {
@@ -68,4 +70,4 @@ _pipe_has_data :: proc(r: ^File) -> (ok: bool, err: Error) {
return false, .Broken_Pipe
}
return false, nil
}
}