Skip to content

Commit

Permalink
fix: Use stderr for console.{warn,error} (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
CountBleck committed May 21, 2023
1 parent 0366245 commit 4399cff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions assembly/wasi_console.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ export namespace wasi_console {
}

export function warn(message: string = ""): void {
let stdout = wasi_process.stdout;
let stdout = wasi_process.stderr;
stdout.write("Warning: ");
stdout.write(message);
stdout.write("\n");
}

export function error(message: string = ""): void {
let stdout = wasi_process.stdout;
let stdout = wasi_process.stderr;
stdout.write("Error: ");
stdout.write(message);
stdout.write("\n");
Expand Down
3 changes: 2 additions & 1 deletion tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ const wasi = new WASI({
"b": 98,
"c": 99
},
returnOnExit: true
returnOnExit: true,
version: "preview1"
});
const { instance } = await WebAssembly.instantiate(binary, {
"wasi_snapshot_preview1": wasi.wasiImport
Expand Down

0 comments on commit 4399cff

Please sign in to comment.