Make PipeIOServer a contextmanager

This commit is contained in:
Kristóf Tóth
2019-06-23 18:40:06 +02:00
parent a1e3fe9813
commit 1155011b48
2 changed files with 13 additions and 18 deletions

View File

@ -77,3 +77,10 @@ class PipeIOServer(Thread):
def wait(self):
self._stop_event.wait()
def __enter__(self):
self.start()
return self
def __exit__(self, type_, value, tb):
self.stop()