When stdout is closed (piped to a dead process, broken terminal),
Python raises ValueError('I/O operation on closed file'), not OSError.
_safe_print and the API error printer only caught OSError, letting the
ValueError propagate and crash the agent.
Salvaged from PR #3760 by @apexscaleai. Fixes #3534.
Co-authored-by: apexscaleai <apexscaleai@users.noreply.github.com>
410 KiB
410 KiB