Skip to content

Commit 1ae67a4

Browse files
committed
use PYTHONUNBUFFERED=1 to ensure Python flushes stdio automatically
Signed-off-by: Joel Dice <joel.dice@fermyon.com>
1 parent d4aa24f commit 1ae67a4

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build: target/config.txt target/lib
44
wasi-vfs/target/release/wasi-vfs pack target/wasm32-wasi/release/python_wasi.wasm \
55
--mapdir lib::$$(pwd)/target/lib \
66
-o target/wasm32-wasi/release/python-wasi-vfs.wasm
7-
PYTHONPATH=/py wizer target/wasm32-wasi/release/python-wasi-vfs.wasm \
7+
PYTHONUNBUFFERED=1 PYTHONPATH=/py wizer target/wasm32-wasi/release/python-wasi-vfs.wasm \
88
--inherit-env true --wasm-bulk-memory true --allow-wasi --dir py \
99
-o target/wasm32-wasi/release/python-wasi-vfs-wizer.wasm
1010

@@ -15,4 +15,6 @@ target/config.txt:
1515

1616
target/lib:
1717
mkdir -p $@
18-
rsync -a --exclude='*.a' --exclude='*.pyc' --exclude='*.whl' cpython/builddir/wasi/install/lib/python3.11 $@
18+
rsync -a --exclude='*.a' --exclude='*.pyc' --exclude='*.whl' --exclude=Makefile \
19+
--exclude=Changelog --exclude=NEWS.txt \
20+
cpython/builddir/wasi/install/lib/python3.11 $@

py/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from spin_http import Response
22

33
def handle_request(request):
4-
print("hello, world!")
4+
print(f"Got request URI: {request.uri}")
55
return Response(200, [("content-type", "text/plain")], f"Hello from Python! Got request URI: {request.uri}")

0 commit comments

Comments
 (0)