Skip to content

Commit

Permalink
Remove special treatment of stdin file descriptor
Browse files Browse the repository at this point in the history
This is now no longer necessary since we send all file descriptors anyway.
  • Loading branch information
marcelm committed Jul 17, 2024
1 parent 6bde7d8 commit f395f56
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions src/cutadapt/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ def __init__(
connections: Sequence[Connection],
queue: multiprocessing.Queue,
buffer_size: int,
stdin_fd: int,
):
"""
Args:
Expand All @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand Down

0 comments on commit f395f56

Please sign in to comment.