WebAssembly / WebAssembly/WASI

missing termios.h functionality

Open
#161 18 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature-request S-inactive
Dominant language
Rust
Stars
5.8k
Forks
333
Avg merge
2d 13h
Merged PRs (30d)
3

Description

while trying to port a simple command line application to WASI and the console crate in particular, i stumbled over some unpleasant limitations concerning unbuffered keyboard input and suppressed echo output for passwd entries as required by many CLI applications.

i perfectly understand the motivations, why this features were not needed/available in CloudABI, and i respect the reservations to pick up a POSIX interface, which is full of unnecessary historic cruft and furthermore isn't supported on the windows platform, nevertheless there is not much alternative available except inventing the wheel once again. but without any intermediating system interface, we are simply not able to work around this grave limitation.

in practice we would most likely only need a small part of the features provided by termios.h resp. tcgetattr/tcsetattr/tcflush, but it's perhaps better for the practical portability of existing *nix code to just reuse this old fashioned POSIX interface the way it is. this should work on nearly any platform except windows, but even on this platform we could implement the needed features via SetConsoleMode etc. without much security worries.

the most essential feature missing are IMHO:

  • unbuffered single key input
  • suppressed echo for password entries

most other terminal control is anyway available via virtual terminal escape sequences (...although a more suitable forwarding of environment variables by the runtime implementations -- especially: TERM, TZ and the locale related ones -- would be also very helpful for this purpose resp. better CLI application support).

there are already similar closed feature requests available (eg. #42) and some brave developers are already looking for rather unorthodox workarounds (see: https://github.com/wasmerio/wasmer-js/issues/141), nevertheless i really would like to get an idea, what we should expected as the desired solution for this issue in the long run.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source files or tests are named. Start by reviewing the requested termios.h operations, especially tcgetattr, tcsetattr, and tcflush, along with related issue #42 and the referenced workaround discussion. Done means agreeing on the long-term interface and providing unbuffered key input and suppressed password echo for WASI CLI applications.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
cli, operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.