kaxil commented on code in PR #44263:
URL: https://github.com/apache/airflow/pull/44263#discussion_r1852682440
##########
task_sdk/src/airflow/sdk/execution_time/supervisor.py:
##########
@@ -192,7 +203,7 @@ def exit(n: int) -> NoReturn:
sys.stdout.flush()
with suppress(ValueError, OSError):
sys.stderr.flush()
- with suppress(ValueError, OSError):
+ with suppress(ValueError, OSError, AttributeError):
Review Comment:
What could cause an `AttributeError` here?
##########
task_sdk/src/airflow/sdk/execution_time/supervisor.py:
##########
@@ -131,17 +131,17 @@ 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, sock, mode, close in (
- ("stdin", child_stdin, "r", True),
- ("stdout", child_stdout, "w", True),
- ("stderr", child_stderr, "w", False),
+ for handle_name, sock, mode in (
+ ("stdin", child_stdin, "r"),
+ ("stdout", child_stdout, "w"),
+ ("stderr", child_stderr, "w"),
):
handle = getattr(sys, handle_name)
try:
fd = handle.fileno()
os.dup2(sock.fileno(), fd)
- if close:
- handle.close()
+ # dup2 creates another open copy of the fh, we can close the
"socket" copy of it.
Review Comment:
```suggestion
# dup2 creates another open copy of the fd, we can close the
"socket" copy of it.
```
--
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]