assemblyscript
assemblyscript copied to clipboard
console.error doesn't send output to STDERR, but to STDOUT
console.error doesn't send output to STDERR, but to STDOUT, prepended with string "Error:"
console.error should send output to STDERR, similar to Console from as-wasi
Under what environment are you running the module? More information would be helpful.
For example, linux bash:
wasmtime test.wasm > out.txt 2>error.txt
These 2 files are correctly populated for Console.error / Console.log, but for built-in console, all output goes go out.txt, while error.txt is empty.
Relevant code section appears to be here:
https://github.com/AssemblyScript/wasi-shim/blob/0d84fc60e493c8dc2750db5d5faffd240401e469/assembly/wasi_console.ts#L39-L51
@dcodeIO right.
Also, the strings specified by programmer shouldn't be changed (eg prepend "Error:"). This output might be parsed by something else. We can concatenate strings ourselves, if that's what we need.
This output might be parsed by something else.
@mariusa why not parse around those prepended strings then? If finer-grained control is needed, process.stderr.write("foo\n") can be used. I'd think console.{log,error,info,debug,warn}()is used for quick-and-dirty debugging, and the prefixes don't really matter in that case.