[Bugfix] Make suppress_stdout redirect fd 1 instead of sys.stdout.fileno() (#59336)

Signed-off-by: usmanmateen <usmanmateen255@gmail.com>
Co-authored-by: Misha Goin <mgoin64@gmail.com>
This commit is contained in:
Muhammad Usman Mateen
2026-10-08 09:52:50 +00:00
committed by GitHub
co-authored by Misha Goin
parent dfaabf91ac
commit e73895a5df
2 changed files with 26 additions and 2 deletions
+2 -1
View File
@@ -72,7 +72,8 @@ def suppress_stdout():
yield
return
stdout_fd = sys.stdout.fileno()
# C libraries write to fd 1, whatever sys.stdout is bound to.
stdout_fd = 1
stdout_dup = os.dup(stdout_fd)
devnull_fd = os.open(os.devnull, os.O_WRONLY)