ANSI escape codes?

42 views
Skip to first unread message

janezz55

unread,
Jun 25, 2021, 6:33:36 PM6/25/21
to emscripten-discuss
If I output ANSI escape codes using std::cout nothing shows, when I run the "executable" with nodejs. Is this a known problem and does there exist a workaround? Supposedly, ANSI codes are supported by nodejs, but apparently not emscripten.

Dan Stromberg

unread,
Jun 26, 2021, 1:01:03 AM6/26/21
to emscripte...@googlegroups.com
On Fri, Jun 25, 2021 at 3:33 PM janezz55 <jane...@gmail.com> wrote:
If I output ANSI escape codes using std::cout nothing shows, when I run the "executable" with nodejs. Is this a known problem and does there exist a workaround?

I don't know much about nodejs or emscripten, but I do know a little about terminal emulation having written a curses implementation a while back.

Is it possible it wasn't nodejs that was interpreting the escape sequences, but really the terminal emulator you were running it in?

I'm guessing emscripten won't interpret escape sequences because the browser it's running in doesn't.  If you truly need escape sequences in a browser, you Might be able to find a library that does it - no guarantees.

You might be better off going with the DOM inside a browser.  Maybe this URL will help?  https://emscripten.org/docs/api_reference/html5.h.html

Good luck.

janezz55

unread,
Jun 26, 2021, 8:13:24 AM6/26/21
to emscripten-discuss
I believe it is this that crashes emscipten-compiled programs. I reported a bug. I wonder why it compiles at all.

  int w, h;

  {
    struct winsize ws;
    ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws);

    w = ws.ws_col;
    h = ws.ws_row - 1;
Reply all
Reply to author
Forward
0 new messages