Skip to content

Instantly share code, notes, and snippets.

Created December 2, 2011 05:08
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ddbeck/1421861 to your computer and use it in GitHub Desktop.
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__':
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