Commit graph

7 commits

Author SHA1 Message Date
Hood Chatham
12d2f373b9
gh-124621: Emscripten: Fix __syscall_ioctl patch (GH-136993)
If there is an error, we have to return `-errno` not positive errno.
Included in backport of GH-136931: #136988
2025-07-22 15:05:26 +02:00
Hood Chatham
c933a6bb32
gh-124621: Emscripten: Support pyrepl in browser (GH-136931)
Basic support for pyrepl in Emscripten. Limitations:
* requires JSPI
* no signal handling implemented

As followup work, it would be nice to implement a webworker variant
for when JSPI is not available and proper signal handling.

Because it requires JSPI, it doesn't work in Safari. Firefox requires
setting an experimental flag. All the Chromiums have full support since
May. Until we make it work without JSPI, let's keep the original web_example
around.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Éric <merwok@netwok.org>
2025-07-22 12:13:38 +02:00
adam j hartz
d1d526afe7
gh-136251: Improvements to WASM demo REPL (GH-136252)
Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-07-21 11:56:45 +02:00
Hood Chatham
800d37feca
gh-124621: Emscripten: Fix regression in use-after-close error handling (#136837) 2025-07-19 21:43:50 +02:00
Hood Chatham
7ae4749d06
gh-124621: Emscripten: Add support for async input devices (GH-136822)
This is useful for implementing proper `input()`. It requires the
JavaScript engine to support the wasm JSPI spec which is now stage 4.
It is supported on Chrome since version 137 and on Firefox and node
behind a flag.

We override the `__wasi_fd_read()` syscall with our own variant that
checks for a readAsync operation. If it has it, we use our own async
variant of `fd_read()`, otherwise we use the original `fd_read()`.
We also add a variant of `FS.createDevice()` called
`FS.createAsyncInputDevice()`.

Finally, if JSPI is available, we wrap the `main()` symbol with
`WebAssembly.promising()` so that we can stack switch from `fd_read()`.
If JSPI is not available, attempting to read from an AsyncInputDevice
will raise an `OSError`.
2025-07-19 17:14:29 +02:00
Hood Chatham
12e52cad71
gh-127146: Emscripten: Make os.umask() actually work (#136706)
Provide a stub implementation of umask that is enough to get some tests passing.
More work is needed upstream in Emscripten to make all umask tests to pass.
2025-07-16 15:33:15 +02:00
Hood Chatham
e81c4e84b3
gh-127146: Report uid in Emscripten + node as native uid (#136509)
Corrects the handling of getuid on emscripten, which was consistently reporting as 0.
2025-07-16 06:17:16 +02:00