diff --git a/pipe_io_server/pipe_io_thread.py b/pipe_io_server/pipe_io_thread.py index 91a50b4..38cea18 100644 --- a/pipe_io_server/pipe_io_thread.py +++ b/pipe_io_server/pipe_io_thread.py @@ -9,11 +9,14 @@ class PipeIOThread(Thread): self._stop_event = Event() self.__io_threads = [] - @terminate_process_on_failure - def run(self): + def start(self): + super().start() self.__io_threads.extend(self._io_threads()) for thread in self.__io_threads: thread.start() + + @terminate_process_on_failure + def run(self): self._stop_event.wait() self._stop_threads() diff --git a/pipe_io_server/test_pipe_io_server.py b/pipe_io_server/test_pipe_io_server.py index 651cba9..82bbdd5 100644 --- a/pipe_io_server/test_pipe_io_server.py +++ b/pipe_io_server/test_pipe_io_server.py @@ -224,3 +224,10 @@ def test_assign_message_handler(): test_data = token_urlsafe(32).encode() io_pipes.send_message(test_data) assert io_pipes.recv() == test_data * 2 + + +def test_write_immediately(): + for _ in range(10): + pipe_io = PipeIOServer(*get_test_init_params()) + with pipe_io: + pipe_io.send_message(b'cica') diff --git a/setup.py b/setup.py index 0155b68..aa9aa2b 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ with open('README.md', 'r') as ifile: setup( name='pipe_io_server', - version='1.0.1', + version='1.0.2', author='Kristóf Tóth', author_email='mrtoth@strongds.hu', description='A trivial to use IPC solution based on pipes and newlines',