I have a question I was hoping to get some advice on. I have a library currently that executes a given cmd. Let's say, for a linux cmd: my_cmd, which produces an interactive menu requiring a series of answers. So in my case:
[ #] some_cmd
Would you like to continue?
y
Enter a value:
andy
You entered andy, please try again:
(valid values are a, b, c)
Now you can see, if I provide ':' as a prompt, the problem that will happen. In the third question, there is still a line after the ':'.
What I'm wondering, has anyone found a way to just read until the prompt is finished? So that if the output is:
"Enter your response:"
or
"Please specify a value:
(a, b, or c)"
It would know to wait until the very end regardless of match.
Since it seems that it reads the output one char at a time, it would be difficult to use a regex or some other match to check for last end of line or new line. Hopefully my question is clear.
Thanks you.