Skip to content

Commit

Permalink
Merge pull request #18 from JonathonReinhart/fix-brokenpipeerror-in-c…
Browse files Browse the repository at this point in the history
…lose

Fix BrokenPipeError in SpiceRecordWrapper.close()
  • Loading branch information
JonathonReinhart authored Jun 23, 2020
2 parents e525228 + 30c7524 commit dacbc76
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions spicerecord/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,12 @@ def __exit__(self, *exc_info):
def stop(self):
if self.stopped:
raise Exception("stop() already called")
self.p.stdin.write(b'Q\n')
self.p.stdin.close()
try:
self.p.stdin.write(b'Q\n')
self.p.stdin.close()
except (BrokenPipeError, IOError):
# The process has already exited
pass
self.stopped = True

def wait(self):
Expand Down

0 comments on commit dacbc76

Please sign in to comment.