Here is my scenario:
I need to build a web UI displaying a terminal console over a SSH connection. The terminal console has an option to run and debug a shell script, as well as providing an interactive console.
- In interactive mode: after a successful connection, the end user may issue freely commands against the shell (SendKey() + Process(timeout) loop).
- In run mode: the script is executed command by command (SendCommand(cmd) and then ReadUntil(event)).
- In debug mode: the script is executed also command by command but, between two successive commands, the end user may manually issue other commands. Here is where I'm starting to have problems (I suppose) due to the combination of ReadUntil() and Process(), specifically an System.InvalidOperationException: Another operation is pending.
Do you have a suggestion, or some kind of sample link, about how to safely achieve the debug mode scenario? Thanks!
Note: the whole logic occurs on the server using virtual terminals, client side communication is not relevant for this problem.