-
-
Notifications
You must be signed in to change notification settings - Fork 34.3k
Open
Labels
OS-emscripteninterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement
Description
The standard streams that Emscripten provides out of the box have the following deficiencies:
- The emscripten std streams always have isatty set to true, whereas they should reflect isatty for the node std streams.
- The emscripten std streams don't support the ttygetwinsize ioctl so
shutil.get_terminal_size()doesn't work. - The emscripten std streams introduce an extra layer of buffering which has
to be flushed with fsync(). - The emscripten std streams are slow and complex because they go through a
character-based handler layer. This is particularly awkward because both
sides of this character based layer deal with buffers and so we need
complex adaptors, buffering, etc on both sides. Removing this
character-based middle layer makes everything better.
https://github.com/emscripten-core/emscripten/blob/1aa7fb531f11e11e7ae49b75a24e1a8fe6fa4a7d/src/lib/libtty.js?plain=1#L104-L114
These issues are fixed in Pyodide in this file:
https://github.com/pyodide/pyodide/blob/main/src/js/streams.ts
We can fix it with an adapted version of that file.
Inspired by the discussion of terminal coloring here:
python/buildmaster-config#687 (comment)
The Emscripten build bot was coloring the output but other build bots don't. The reason was tracked down to the incorrect behavior of isatty because if isatty(stdout) is false, unittest will automatically disable terminal coloring. So this will fix the build bot.
Linked PRs
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
OS-emscripteninterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement