bytecodealliance / wasmtime

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

Clearing console prints characters instead #964

Closed Rochet2 closed 4 years ago

Rochet2 commented 4 years ago

The following code is suggested to be used to clear the console. The code seems to print the characters to console instead of clearing the console. Using ubuntu 18.04.4 tested with c94cdc7730bc2cf5e97c21678a0e393860dc092d and 9c6150b10312e2c4aec27b5885ceba8fb2fc6ce1

#include <stdio.h>

int main (int argc, char *argv[]) {
    printf ("Hello world!\n");
    /* try clear console */
    puts ("\033[H\033[J");
    printf("\e[1;1H\e[2J"); 
    return 0;
}

image

Other wasm runtimes like wasm3, wasmer and wavm seemed to clear the console as expected with both codes. Is this something that should be supported / is a bug?

rene-fonseca commented 4 years ago

wasmtime filters ansi escape codes that could be used to trick/mislead users.

You can check the topic at https://github.com/WebAssembly/WASI/issues/162

Rochet2 commented 4 years ago

thanks