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 Apr 23, 2024
1 parent f4f8ea8 commit 2fb7014
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 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 @@ -81,12 +80,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 +305,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 +315,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 2fb7014

Please sign in to comment.