mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-09 21:43:40 +00:00
wasm: correctly return from run() in wasm_exec.js
Instead of hanging forever, it should return the exit code from os.Exit.
This commit is contained in:
@@ -80,12 +80,17 @@ func abort() {
|
||||
|
||||
//go:linkname syscall_Exit syscall.Exit
|
||||
func syscall_Exit(code int) {
|
||||
// TODO: should we call __stdio_exit here?
|
||||
// It's a low-level exit (syscall.Exit) so doing any libc stuff seems
|
||||
// unexpected, but then where else should stdio buffers be flushed?
|
||||
// Flush stdio buffers.
|
||||
__stdio_exit()
|
||||
|
||||
// Exit the program.
|
||||
proc_exit(uint32(code))
|
||||
}
|
||||
|
||||
func mainReturnExit() {
|
||||
syscall_Exit(0)
|
||||
}
|
||||
|
||||
// TinyGo does not yet support any form of parallelism on WebAssembly, so these
|
||||
// can be left empty.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user