jupyterlite / cockle

In-browser bash-like shell implemented in TypeScript.
BSD 3-Clause "New" or "Revised" License
3 stars 2 forks source link

Add support for stdin redirect from file such as 'wc < somefile' #12

Closed ianthomas23 closed 3 months ago

ianthomas23 commented 3 months ago

This adds support for stdin redirect from file. For example

wc < somefile

as well as the existing

wc somefile

The WASM commands poll for a character at a time, so the solution here is to store the file contents and feed them to the command a character at a time. A more complicated solution will be required to read stdin from the terminal whilst a command is running (such as less) as the terminal is async. This might be a separate thread and polling perhaps.