Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use a worker thread for stdin on Unix with preview2
Currently stdin on Unix uses `AsyncFd` after setting the nonblocking flag on the stdin file descriptor. This cannot generally be relied on to succeed or work well in cases such as: * On Linux if stdin is a file (e.g. `wasmtime < ./foo.txt`) then that can't be added to epoll and `epoll_ctl` fails with EPERM. * On macOS if stdin is `/dev/null` that can't be added to kqueue and fails with `EINVAL`. Currently this causes Wasmtime to panic due to a `.unwrap()` in failing to register stdin. To fix this this commit removes the Unix-specific logic using `AsyncFd` and instead falls back to unconditionally using a spawned thread like Windows does. This does mean it's a little less lightweight but should be more robust in situations like the above.
- Loading branch information