bytecodealliance / javy

JS to WebAssembly toolchain
Apache License 2.0
2.1k stars 101 forks source link

Allow specifying which file descriptor is used in console.{log,err} from the CLI #628

Open Niikelion opened 3 months ago

Niikelion commented 3 months ago

Operating system: windows + wsl2-ubuntu, windows Processor architecture: x86_64 Rust version: rustup 1.27.0 Javy version: javy 1.4.0

Problem

After compiling console.log("test") into .wasm file and executing it with wasmtime I get output on stderr instead of stdout. I verified that its not an wasmtime problem by compiling and running simple c program with printf("test\n"). Testing was done in windows and wsl2 with ubuntu on windows and in happens in both cases.

saulecabrera commented 3 months ago

It indeed does. I believe we should make this behavior configurable from the CLI level too, because currently it's not standard. For some context, some use-cases require tight control over which stream is used for console.{log,err}, however, in this case the non-standard behavior has "leaked" as the standard one.

saulecabrera commented 3 months ago

I'll switch the label and title of the issue to reflect that we want to make this behavior configurable.