From 08ebe8e7f6b56f9ed63fb28d6974a8f82f1664a2 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 16 Nov 2010 12:36:31 -0500 Subject: [PATCH] Update abcplay.py to handle pre-terminated subprocesses. --- posts/abcplay/abcplay.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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 -- 2.26.2