Commit 592815f
committed
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.1 parent 215eb35 commit 592815f
2 files changed
Lines changed: 0 additions & 140 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | 3 | | |
10 | | - | |
11 | 4 | | |
12 | 5 | | |
13 | 6 | | |
| |||
This file was deleted.
0 commit comments