From f395f56df39ea1b07f6cf205b71d78fae0dbbc9b Mon Sep 17 00:00:00 2001 From: Marcel Martin Date: Tue, 23 Apr 2024 23:23:15 +0200 Subject: [PATCH] Remove special treatment of stdin file descriptor This is now no longer necessary since we send all file descriptors anyway. --- src/cutadapt/runners.py | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/cutadapt/runners.py b/src/cutadapt/runners.py index 23b77c01..c384bf33 100644 --- a/src/cutadapt/runners.py +++ b/src/cutadapt/runners.py @@ -56,7 +56,6 @@ def __init__( connections: Sequence[Connection], queue: multiprocessing.Queue, buffer_size: int, - stdin_fd: int, ): """ Args: @@ -68,7 +67,6 @@ def __init__( queue: a Queue of worker indices. A worker writes its own index into this queue to notify the reader that it is ready to receive more data. buffer_size: - stdin_fd: """ super().__init__() self._input_fds_pipe = input_fds_pipe @@ -81,12 +79,8 @@ def __init__( self.connections = connections self.queue = queue self.buffer_size = buffer_size - self.stdin_fd = stdin_fd def run(self): - if self.stdin_fd != -1: - sys.stdin.close() - sys.stdin = os.fdopen(self.stdin_fd) try: with ExitStack() as stack: try: @@ -310,12 +304,6 @@ def __init__( # the workers read from these connections connections = [mpctx.Pipe(duplex=False) for _ in range(self._n_workers)] self._connections, connw = zip(*connections) - try: - fileno = sys.stdin.fileno() - except io.UnsupportedOperation: - # This happens during tests: pytest sets sys.stdin to an object - # that does not have a file descriptor. - fileno = -1 file_format_connection_r, file_format_connection_w = mpctx.Pipe(duplex=False) input_fds_pipe_r, input_fds_pipe_w = mpctx.Pipe() @@ -326,7 +314,6 @@ def __init__( connections=connw, queue=self._need_work_queue, buffer_size=self._buffer_size, - stdin_fd=fileno, ) self._reader_process.daemon = True self._reader_process.start()