Update abcplay.py to handle pre-terminated subprocesses.
authorW. Trevor King <wking@drexel.edu>
Tue, 16 Nov 2010 17:36:31 +0000 (12:36 -0500)
committerW. Trevor King <wking@drexel.edu>
Tue, 16 Nov 2010 17:36:31 +0000 (12:36 -0500)
posts/abcplay/abcplay.py

index a3cd6c7ff4956233db89a7474409752507847f7a..9d840895686659153378f3fc1a1a05f129c244aa 100755 (executable)
@@ -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