Skip to content

Commit cf7b7fe

Browse files
adqmhoodmane
authored andcommitted
gh-136251: Improvements to WASM demo REPL (GH-136252)
(cherry picked from commit d1d526a) Co-authored-by: adam j hartz <adam@smatz.net> Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
1 parent d118bc0 commit cf7b7fe

File tree

7 files changed

+327
-56
lines changed

7 files changed

+327
-56
lines changed

Makefile.pre.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,7 +1096,7 @@ $(DLLLIBRARY) libpython$(LDVERSION).dll.a: $(LIBRARY_OBJS)
10961096
# wasm32-emscripten browser web example
10971097

10981098
WEBEX_DIR=$(srcdir)/Tools/wasm/emscripten/web_example/
1099-
web_example/python.html: $(WEBEX_DIR)/python.html
1099+
web_example/index.html: $(WEBEX_DIR)/index.html
11001100
@mkdir -p web_example
11011101
@cp $< $@
11021102

@@ -1124,7 +1124,7 @@ web_example/python.mjs web_example/python.wasm: $(BUILDPYTHON)
11241124
cp python.wasm web_example/python.wasm
11251125

11261126
.PHONY: web_example
1127-
web_example: web_example/python.mjs web_example/python.worker.mjs web_example/python.html web_example/server.py $(WEB_STDLIB)
1127+
web_example: web_example/python.mjs web_example/python.worker.mjs web_example/index.html web_example/server.py $(WEB_STDLIB)
11281128

11291129
############################################################################
11301130
# Header files
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixes and usability improvements for ``Tools/wasm/emscripten/web_example``

Python/emscripten_syscalls.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ EM_JS_MACROS(void, _emscripten_promising_main_js, (void), {
100100
return;
101101
}
102102
const origResolveGlobalSymbol = resolveGlobalSymbol;
103-
if (!Module.onExit && process?.exit) {
103+
if (!Module.onExit && globalThis?.process?.exit) {
104104
Module.onExit = (code) => process.exit(code);
105105
}
106106
// * wrap the main symbol with WebAssembly.promising,

Tools/wasm/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ https://github.com/psf/webassembly for more information.
2222
### Build
2323

2424
To cross compile to the ``wasm32-emscripten`` platform you need
25-
[the Emscripten compiler toolchain](https://emscripten.org/),
25+
[the Emscripten compiler toolchain](https://emscripten.org/),
2626
a Python interpreter, and an installation of Node version 18 or newer.
2727
Emscripten version 4.0.2 is recommended; newer versions may also work, but all
2828
official testing is performed with that version. All commands below are relative
@@ -86,11 +86,11 @@ CLI you will need to write your own alternative to `node_entry.mjs`.
8686

8787
### The Web Example
8888

89-
When building for Emscripten, the web example will be built automatically. It is
90-
in the ``web_example`` directory. To run the web example, ``cd`` into the
89+
When building for Emscripten, the web example will be built automatically. It
90+
is in the ``web_example`` directory. To run the web example, ``cd`` into the
9191
``web_example`` directory, then run ``python server.py``. This will start a web
92-
server; you can then visit ``http://localhost:8000/python.html`` in a browser to
93-
see a simple REPL example.
92+
server; you can then visit ``http://localhost:8000/`` in a browser to see a
93+
simple REPL example.
9494

9595
The web example relies on a bug fix in Emscripten version 3.1.73 so if you build
9696
with earlier versions of Emscripten it may not work. The web example uses

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy