wasm: call __stdio_exit on exit

This flushes stdio, so that functions like puts and printf write out all
buffered data even if the output isn't connected to a terminal.

For discussion, see:
https://github.com/bytecodealliance/wasmtime/issues/7833
This commit is contained in:
Ayke van Laethem
2024-02-16 16:33:07 +01:00
committed by Ron Evans
parent 55f7d21ff5
commit 3021e16bbf
3 changed files with 10 additions and 0 deletions
+1
View File
@@ -19,6 +19,7 @@ func _start() {
heapStart = uintptr(unsafe.Pointer(&heapStartSymbol))
heapEnd = uintptr(wasm_memory_size(0) * wasmPageSize)
run()
__stdio_exit()
}
// Read the command line arguments from WASI.