Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use stderr for console.{warn,error}() #1

Merged
merged 2 commits into from
May 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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