Skip to content

missing termios.h functionalityΒ #161

Open
@mash-graz

Description

@mash-graz

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: wasmerio/wasmer-js#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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions