If you're looking for Expect like behaviour, have you tried the Expect module? It may already do exactly what you want, exactly the way you're thinking of the problem.
In reply to Re: interactively catching STDOUT/STDERR messages
by Tanktalus
in thread interactively catching STDOUT/STDERR messages
by ckyang74
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |