From 8f80f49a86cf7e42194d3eda609f7bba8b86af43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Thu, 9 May 2019 13:26:48 +0200 Subject: [PATCH] Implement support for waiting for PipeIOServer to stop --- echo_server.py | 1 + pipe_io_server/pipe_io_server.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/echo_server.py b/echo_server.py index 12ef8b2..c87751b 100644 --- a/echo_server.py +++ b/echo_server.py @@ -16,3 +16,4 @@ if __name__ == "__main__": print('Running pipe IO server with named pipes:') print(f'Input: {pipe_io.in_pipe}') print(f'Output: {pipe_io.out_pipe}') + pipe_io.wait() diff --git a/pipe_io_server/pipe_io_server.py b/pipe_io_server/pipe_io_server.py index a36b8f0..6abaa40 100644 --- a/pipe_io_server/pipe_io_server.py +++ b/pipe_io_server/pipe_io_server.py @@ -58,3 +58,6 @@ class PipeIOServer(ABC, Thread): thread.stop() Pipe(self.in_pipe).remove() Pipe(self.out_pipe).remove() + + def wait(self): + self._stop_event.wait()