From: W. Trevor King Date: Tue, 16 Nov 2010 17:36:31 +0000 (-0500) Subject: Update abcplay.py to handle pre-terminated subprocesses. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=08ebe8e7f6b56f9ed63fb28d6974a8f82f1664a2;p=blog.git Update abcplay.py to handle pre-terminated subprocesses. --- diff --git a/posts/abcplay/abcplay.py b/posts/abcplay/abcplay.py index a3cd6c7..9d84089 100755 --- a/posts/abcplay/abcplay.py +++ b/posts/abcplay/abcplay.py @@ -72,11 +72,17 @@ class ABCPlayer (object): def _kill_p(self): if self._p != None: - self._p.terminate() - self._p.wait() + try: + self._p.terminate() + except OSError, e: + if e.errno == 3: + pass # no such process + else: + raise + else: + self._p.wait() self._p = None - if __name__ == '__main__': import sys