controlling another application - redirecting input and output 这是可能的

ref : Programmatically controlling another application - redirecting
input and output