From 941480028ce8ea778de87dab39a9fecadbcbf3e7 Mon Sep 17 00:00:00 2001 From: Gaukas Wang Date: Sat, 30 Dec 2023 20:34:00 -0700 Subject: [PATCH] fix: allow pollOneoff for EventTypeFdWrite Note this is still a dirty fix... Eventually upstream needs to fully implement this with some major refactoring of the codebase. Signed-off-by: Gaukas Wang --- imports/wasi_snapshot_preview1/poll.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/imports/wasi_snapshot_preview1/poll.go b/imports/wasi_snapshot_preview1/poll.go index d09f30245b..84cd8660bc 100644 --- a/imports/wasi_snapshot_preview1/poll.go +++ b/imports/wasi_snapshot_preview1/poll.go @@ -147,8 +147,10 @@ func pollOneoffFn(_ context.Context, mod api.Module, params []uint64) sys.Errno if fd < 0 { return sys.EBADF } - if _, ok := fsc.LookupFile(fd); ok { - evt.errno = wasip1.ErrnoNotsup + if file, ok := fsc.LookupFile(fd); ok { + if !file.File.IsNonblock() { + evt.errno = wasip1.ErrnoNotsup + } } else { evt.errno = wasip1.ErrnoBadf }