What is a Coprocess?
A coprocess is a job, such as a shell script, that has a special relationship with a particular iTerm2 session. All output in a terminal window (that is, what you see on the screen) is also input to the coprocess. All output from the coprocess acts like text that the user is typing at the keyboard.
One obvious use of this feature is to automate interaction. For instance, suppose you want to automate your presence in a chat room. The following script could be used as a coprocess:
#!/usr/bin/python while True: line = raw_input() if line == "Are you there?": print "Yes" else: print "lol"You could disappear for years before your friends discover you're gone.
How Do I Start a Coprocess?
There are two ways to start a coprocess.- Select "Run Coprocess..." from the Shell menu. Enter the name of a command to run as a coprocess.
- Create a Trigger in Prefs>Profiles>Advaced and select Run Coprocess... as the action. Give the script to run as a parameter.
Usage
A session can not have more than one coprocess at a time. When a coprocess is active, an icon will indicate that in the top right of the session.