webassembly: Use POSIX write for output and add stderr.

All output is now handled by Emscripten's stdio facility.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2023-05-31 11:44:45 +10:00
parent 8e3b701dee
commit ae6bcc9d23
3 changed files with 12 additions and 13 deletions

View File

@@ -25,16 +25,6 @@
*/
mergeInto(LibraryManager.library, {
mp_js_write: function(ptr, len) {
const buffer = HEAPU8.subarray(ptr, ptr + len)
if (ENVIRONMENT_IS_NODE) {
process.stdout.write(buffer);
} else {
const printEvent = new CustomEvent('micropython-print', { detail: buffer });
document.dispatchEvent(printEvent);
}
},
// This string will be emitted directly into the output file by Emscripten.
mp_js_ticks_ms__postset: "var MP_JS_EPOCH = Date.now()",