summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2014-06-21 14:27:05 -0700
committerschneefux <schneefux+commit@schneefux.xyz>2014-06-21 21:32:02 +0000
commit02f3505cd6d585a24d79cca033f30ce88e972563 (patch)
tree9bcf8000e22c681a16075b2cfa7a5d5d01e51bc1
parent893bcdbc388eb7bc5c59fe92f461fc20c7343dec (diff)
downloadjasper-client-02f3505cd6d585a24d79cca033f30ce88e972563.tar.gz
jasper-client-02f3505cd6d585a24d79cca033f30ce88e972563.zip
Escape phrases before 'say'ing them in OS X
-rw-r--r--boot/test.py1
-rw-r--r--client/speaker.py5
2 files changed, 4 insertions, 2 deletions
diff --git a/boot/test.py b/boot/test.py
index 4c79f39..b390d5e 100644
--- a/boot/test.py
+++ b/boot/test.py
@@ -5,7 +5,6 @@ if os.environ.get('JASPER_HOME') is None:
import sys
import unittest
-from sets import Set
from mock import patch
import vocabcompiler
diff --git a/client/speaker.py b/client/speaker.py
index f2d4ab7..e7dc075 100644
--- a/client/speaker.py
+++ b/client/speaker.py
@@ -22,8 +22,11 @@ class MacSpeaker:
def isAvailable(cls):
return os.system("which say") == 0
+ def shellquote(self, s):
+ return "'" + s.replace("'", "'\\''") + "'"
+
def say(self, phrase):
- os.system("say " + phrase)
+ os.system("say " + self.shellquote(phrase))
def playSound(self, filename):
os.system("afplay " + filename)