Printing to stderr

242 views
Skip to first unread message

Arve Knudsen

unread,
Sep 13, 2014, 2:25:19 AM9/13/14
to emscripte...@googlegroups.com
Hello

Does one have to do anything in particular to have stderr output directed to the browser's console in the Emscripten-generated JS code?

Currently, with my ChucK port, I do not see anything being printed to stderr (nor stdout).

Thanks,
Arve

Floh

unread,
Sep 13, 2014, 10:52:15 AM9/13/14
to emscripte...@googlegroups.com
Did you test with the default shell html page? I think all output goes to user-defined functions Module.print or Module.printErr, see here:


For an example of a (very simple) self-rolled shell html page look here (emsc.html and emsc.js):


Cheers,
-Floh.

Arve Knudsen

unread,
Sep 13, 2014, 11:09:56 AM9/13/14
to emscripte...@googlegroups.com
Thanks, I'll have to try. But for now I have a flight to catch...

Arve

--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Arve Knudsen

unread,
Sep 15, 2014, 6:29:00 AM9/15/14
to emscripte...@googlegroups.com
I've tried generating a shell HTML page, and yes it does print stderr to the console. Also, if I include an a.out.js file (generated by em++ without options) in a hand-written HTML page, stderr gets printed to the console as well. So, stderr printing should work, the question is why it's not working in the ChucK case.

Does anyone have any hints as to debugging why Module.printErr doesn't get called for printing to stderr? I've deduced that Module.printErr does in fact write to the console, because Emscripten generates one (successfull) call to it (to inform of 'pre-main prep time'). As such, it seems to me that the code generated from ChucK ends up not calling Module.printErr for printing to stderr.

Arve

--

Arve Knudsen

unread,
Sep 15, 2014, 6:57:24 AM9/15/14
to emscripte...@googlegroups.com
OK, I found out why nothing was being printed. I had forgot to write newlines, so output was only buffered, and it turns out fflush doesn't work either: https://github.com/kripken/emscripten/issues/2770.

Arve
Reply all
Reply to author
Forward
0 new messages