ashb commented on code in PR #51699:
URL: https://github.com/apache/airflow/pull/51699#discussion_r2145529709


##########
task-sdk/src/airflow/sdk/execution_time/supervisor.py:
##########
@@ -224,14 +229,13 @@ def _configure_logs_over_json_channel(log_fd: int):
 def _reopen_std_io_handles(child_stdin, child_stdout, child_stderr):
     # Ensure that sys.stdout et al (and the underlying filehandles for C 
libraries etc) are connected to the
     # pipes from the supervisor
-
     for handle_name, fd, sock, mode in (
-        ("stdin", 0, child_stdin, "r"),
+        # Yes, we want to re-open stdin in write mode! This is cause it is a 
bi-directional socket, so we can
+        # read and write to it.
+        ("stdin", 0, child_stdin, "w"),
         ("stdout", 1, child_stdout, "w"),
         ("stderr", 2, child_stderr, "w"),
     ):
-        handle = getattr(sys, handle_name)
-        handle.close()

Review Comment:
   `dup2` handles the closing for us, and does a better job of dealing with 
race conditions too.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to