Bun: explicitly print the output of the wasm module to the console

This commit is contained in:
Frank Denis 2022-12-19 10:27:08 +01:00
parent 45da50ab0e
commit 374a58c1e1

View File

@ -44,6 +44,7 @@ if [ -z "$WASI_RUNTIME" ] || [ "$WASI_RUNTIME" = "bun" ]; then
echo " const wasm = await WebAssembly.compile(fs.readFileSync('${1}'));" echo " const wasm = await WebAssembly.compile(fs.readFileSync('${1}'));"
echo " await wasi.instantiate(wasm, {});" echo " await wasi.instantiate(wasm, {});"
echo " wasi.start();" echo " wasi.start();"
echo " console.log(wasi.getStdoutString());"
echo "})().catch(e => { console.error(e); process.exit(1); });" echo "})().catch(e => { console.error(e); process.exit(1); });"
} >"${1}.mjs" } >"${1}.mjs"
bun run "${1}.mjs" 2>/tmp/err && bun run "${1}.mjs" 2>/tmp/err &&