Created
June 29, 2018 04:42
-
-
Save dmoney/f60f0614eed40eed53728bcfd5fe0a63 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys, os | |
def alert(): | |
os.system('say -v Tessa "Your task has been completed."') | |
def alert_on_pipe_close(): | |
try: | |
while True: | |
text = sys.stdin.read() | |
if text == '': | |
sys.stdout.flush() | |
break | |
sys.stdout.write(text) | |
finally: | |
alert() | |
if __name__ == '__main__': | |
alert_on_pipe_close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment