How do you pipe input and output to and from an interactive shell?
问题 I am trying to build an application that enables the user to interact with a command-line interactive shell, like IRB or Python. This means that I need to pipe user input into the shell and the shell's output back to the user. I was hoping this was going to be as easy as piping STDIN, STDOUT, and STDERR, but most shells seem to respond differently to STDIN input as opposed to direct keyboard input. For example, here is what happens when I pipe STDIN into python : $ python 1> py.out 2> py.err