This PR is to support receiving stdin whilst running WASM commands. Normally the Shell receives stdin from the @xterm terminal in the main worker via async messages passed to the webworker that is running the shell. WASM commands here run synchronously so they block the webworker, hence if they want to receive stdin whilst running they cannot do so as they never yield to other async tasks such that async stdin messages are not handled until the command has finished.
The solution here is to add buffering of stdin on the front end (the main worker) whilst a command is running and the command requests stdin synchronously when it needs it, and indeed blocks until it receives it. The major code changes are to add two new callbacks from cockle to the terminal extension, one to enable/disable stdin buffering, and the other a blocking request for a character from stdin. The IInput classes have been refactored to accommodate this.
This needs to be merged and a new release (0.0.5) made before the corresponding changes can be added to the terminal extension.
This PR is to support receiving stdin whilst running WASM commands. Normally the
Shell
receives stdin from the@xterm
terminal in the main worker via async messages passed to the webworker that is running the shell. WASM commands here run synchronously so they block the webworker, hence if they want to receive stdin whilst running they cannot do so as they never yield to other async tasks such that async stdin messages are not handled until the command has finished.The solution here is to add buffering of stdin on the front end (the main worker) whilst a command is running and the command requests stdin synchronously when it needs it, and indeed blocks until it receives it. The major code changes are to add two new callbacks from
cockle
to theterminal
extension, one to enable/disable stdin buffering, and the other a blocking request for a character from stdin. TheIInput
classes have been refactored to accommodate this.This needs to be merged and a new release (0.0.5) made before the corresponding changes can be added to the
terminal
extension.