Skip to content

Instantly share code, notes, and snippets.

@ddbeck ddbeck/
Created Dec 2, 2011

What would you like to do?
a Coprocess script for iTerm2 to read aloud Fabric task completion
# use as a trigger.
# Trigger regex: Executing task '(.*)'$
# Coprocess command: $HOME/bin/ \1
import subprocess
import sys
def incoming():
while True:
yield raw_input()
def say(phrase):['say', phrase])
def main():
task_name = sys.argv[1]
say('Starting {}'.format(task_name))
for line in incoming():
if 'Done.' in line:
say('{} finished.'.format(task_name))
if 'Aborting.' in line:
say('{} failed.'.format(task_name))
if 'Executing task' in line and task_name not in line:
say('{} finished.'.format(task_name))
task_name = line[
line.index("Executing task") + len("Executing task") + 1:
say('Starting {}'.format(task_name))
if 'Stopped.' in line:
if __name__ == '__main__':

This comment has been minimized.

Copy link

holyjak commented Apr 30, 2015

Thanks a lot, this was very useful when creating my Coprocess "iTerm coprocess reporting result of (Mocha) tests run via nodemon". I could not have done this without you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.