bytecodealliance / wasmtime

A fast and secure runtime for WebAssembly
https://wasmtime.dev/
Apache License 2.0
15.36k stars 1.3k forks source link

ANSI escape sequences to display colored output not handled correctly #1380

Open samrat opened 4 years ago

samrat commented 4 years ago

I experienced this bug when trying to run the [QuickJS wasm] file. I have created a repo to reproduce the issue.

samrat commented 4 years ago

Looks like this is a deliberate decision and there is a WASI issue discussing this: https://github.com/WebAssembly/WASI/issues/162. I think this can be closed, given this is a known and deliberate limitation.

rene-fonseca commented 4 years ago

The common color codes should be supported for stdout. But you can try to use stderr instead of stdout to see if it works and isn't due to some other problem. stderr should not be filtering the codes at the moment.

samrat commented 4 years ago

Thanks @rene-fonseca.

This could be due to some other problem as this behaviour seems to be happening when I change to output to stderr as well.

sunfishcode commented 4 years ago

Allowing untrusted portable code write directly to a user's terminal is not something any serious system I'm aware of has ever knowingly done before, so we're researching how we can enable this functionality in a way that protects users and provides portability. As a temporary measure, streams which are attatched to ttys, which includes both stdout and stderr, are filtered to neutralize escape sequences and problematic control characters.