This PR allows user to pass input to the launched command via stdin.
It gets a stdinPipe from the launched command, returns it from startCommand , and launches a goroutine that reads lines from os.Stdin and writes those lines to the launched command's stdinPipe.
Note: originally I tried to use bufio.Scanner instead of bufio.Reader to read user input, but had a strange issue where a numeric value (e.g. "2") would not get flushed to stdinPipe. I could type a string of dozens of numeric characters and it was only when I entered an alphabet letter that the full buffer would be written to stdinPipe. I gave up with this approach in the end but any insight as to why this happened would be appreciated!
This PR allows user to pass input to the launched command via stdin.
It gets a
stdinPipe
from the launched command, returns it fromstartCommand
, and launches a goroutine that reads lines fromos.Stdin
and writes those lines to the launched command'sstdinPipe
.Note: originally I tried to use bufio.Scanner instead of bufio.Reader to read user input, but had a strange issue where a numeric value (e.g. "2") would not get flushed to stdinPipe. I could type a string of dozens of numeric characters and it was only when I entered an alphabet letter that the full buffer would be written to stdinPipe. I gave up with this approach in the end but any insight as to why this happened would be appreciated!