javy icon indicating copy to clipboard operation
javy copied to clipboard

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

Open Niikelion opened this issue 1 year ago • 2 comments

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.

Niikelion avatar Apr 13 '24 10:04 Niikelion

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 avatar Apr 15 '24 11:04 saulecabrera

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

saulecabrera avatar Apr 15 '24 11:04 saulecabrera

In the latest main, it's now possible to override this behavior, by doing javy build index.js -J redirect-stdout-to-stderr=n -o index.wasm

saulecabrera avatar Sep 05 '24 13:09 saulecabrera