2018-12-14 14:39:18 +00:00
|
|
|
from signal import signal, SIGTERM, SIGINT
|
|
|
|
|
|
|
|
from pipe_io_server import PipeIOServer
|
|
|
|
|
|
|
|
|
|
|
|
class EchoPipeIOServer(PipeIOServer):
|
2018-12-16 18:16:01 +00:00
|
|
|
def handle_message(self, message):
|
2018-12-14 14:39:18 +00:00
|
|
|
self.send(message)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
pipe_io = EchoPipeIOServer()
|
|
|
|
signal(SIGTERM, lambda a, b: pipe_io.stop())
|
|
|
|
signal(SIGINT, lambda a, b: pipe_io.stop())
|
|
|
|
print('Running pipe IO server with named pipes:')
|
|
|
|
print(f'Input: {pipe_io.in_pipe}')
|
|
|
|
print(f'Output: {pipe_io.out_pipe}')
|
2019-03-28 15:25:53 +00:00
|
|
|
pipe_io.run()
|