GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Emscripten: Improve standard stream handling in node_entry.mjs · Issue #146416 · python/cpython

Emscripten: Improve standard stream handling in node_entry.mjs #146416

New issue
Copy link
New issue
Copy link
Closed
Closed
Emscripten: Improve standard stream handling in node_entry.mjs#146416
Copy link
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

@hoodmane
hoodmane
opened on Mar 25, 2026
Issue body actions

The standard streams that Emscripten provides out of the box have the following deficiencies:

  1. The emscripten std streams always have isatty set to true, whereas they should reflect isatty for the node std streams.
  2. The emscripten std streams don't support the ttygetwinsize ioctl so shutil.get_terminal_size() doesn't work.
  3. The emscripten std streams introduce an extra layer of buffering which has
    to be flushed with fsync().
  4. 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

  • gh-146416: Emscripten: Improve standard stream handling in node_entry.mjs #146417
  • [3.14] gh-146416: Emscripten: Improve standard stream handling in node_entry.mjs (GH-146417) #146630

Activity

  1. hoodmane
    added
    OS-emscripten
    on Mar 25, 2026
  2. hoodmane
    added a commit that references this issue on Mar 25, 2026

    pythongh-146416: Emscripten: Improve standard stream handling in node…

    1e4e9c1
  3. StanFromIreland
    added
    type-featureA feature request or enhancementA feature request or enhancement
    on Mar 25, 2026
  4. picnixz
    added
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    on Mar 26, 2026
  5. vstinner
    added a commit that references this issue on Mar 30, 2026

    gh-146416: Emscripten: Improve standard stream handling in node_entry…

    6857de6
  6. miss-islington
    added a commit that references this issue on Mar 30, 2026

    pythongh-146416: Emscripten: Improve standard stream handling in node…

    2d93923
  7. vstinner
    closed this as completedon Mar 30, 2026
  8. vstinner
    added a commit that references this issue on Mar 30, 2026

    [3.14] gh-146416: Emscripten: Improve standard stream handling in nod…

    ec11485
  9. maurycy
    added a commit that references this issue on Mar 30, 2026

    Merge remote-tracking branch 'upstream/main' into tachyon-ndjson-kole…

    6a0ea81
  10. clin1234
    added a commit that references this issue on Apr 16, 2026

    pythongh-146416: Emscripten: Improve standard stream handling in node…

    5d24496
  11. ljfp
    added a commit that references this issue on Apr 25, 2026

    pythongh-146416: Emscripten: Improve standard stream handling in node…

    5df80ab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.