diff --git a/pipe_io_server/pipe_io_server.py b/pipe_io_server/pipe_io_server.py index bba85ae..33d6772 100644 --- a/pipe_io_server/pipe_io_server.py +++ b/pipe_io_server/pipe_io_server.py @@ -10,7 +10,7 @@ from .pipe import Pipe class PipeIOServer(ABC): def __init__(self, in_pipe=None, out_pipe=None): - self.in_pipe, self.out_pipe = in_pipe, out_pipe + self._in_pipe, self._out_pipe = in_pipe, out_pipe self._io_threads = None self._create_pipes() self._init_io_threads() @@ -18,11 +18,19 @@ class PipeIOServer(ABC): def _create_pipes(self): if not self.in_pipe or not self.out_pipe: pipe_id = token_urlsafe(6) - self.in_pipe = join('/tmp', f'in_pipe_{pipe_id}') - self.out_pipe = join('/tmp', f'out_pipe_{pipe_id}') + self._in_pipe = join('/tmp', f'in_pipe_{pipe_id}') + self._out_pipe = join('/tmp', f'out_pipe_{pipe_id}') Pipe(self.in_pipe).recreate() Pipe(self.out_pipe).recreate() + @property + def in_pipe(self): + return self._in_pipe + + @property + def out_pipe(self): + return self._out_pipe + def _init_io_threads(self): io_threads_dict = { 'reader': PipeReaderThread(self.in_pipe, self.handle_message),