mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 00:01:16 +00:00
wasm: improve the HTML debugger's WASI syscall implementations
This commit is contained in:
parent
55465d15a0
commit
2af4016f34
1 changed files with 7 additions and 4 deletions
|
@ -258,6 +258,7 @@
|
|||
function fd_write(fd, iovs_ptr, iovs_len, nwritten_mut_ptr) {
|
||||
let string_buffer = "";
|
||||
let nwritten = 0;
|
||||
const STDOUT = 1;
|
||||
|
||||
for (let i = 0; i < iovs_len; i++) {
|
||||
const index32 = iovs_ptr >> 2;
|
||||
|
@ -282,16 +283,18 @@
|
|||
}
|
||||
wasiLinkObject.memory32[nwritten_mut_ptr >> 2] = nwritten;
|
||||
if (string_buffer) {
|
||||
console.log(string_buffer);
|
||||
if (fd === STDOUT) {
|
||||
console.log(string_buffer);
|
||||
} else {
|
||||
console.error(string_buffer);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// proc_exit : (i32) -> nil
|
||||
function proc_exit(exit_code) {
|
||||
if (exit_code) {
|
||||
throw new Error(`Wasm exited with code ${exit_code}`);
|
||||
}
|
||||
throw new Error(`Wasm exited with code ${exit_code}`);
|
||||
}
|
||||
|
||||
// Signatures from wasm_test_platform.o
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue