From f5be7536f3a6f898cd38a29c9fb9804deba2e9c3 Mon Sep 17 00:00:00 2001 From: "Genevieve (Genna) Helsel" Date: Tue, 10 Dec 2024 17:54:24 -0800 Subject: [PATCH] teach eden debug log --upload to use IOWithRedaction Summary: `eden rage` was recently taught to run output through redaction. This diff teaches `eden debug log` to do the same, as this uses the same code path as `rage` and needs to match the new expected types Reviewed By: lXXXw Differential Revision: D67061776 fbshipit-source-id: 9846a5f0d8e91cd4787d417ac91420439bfa0d5d --- eden/fs/cli/debug.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/eden/fs/cli/debug.py b/eden/fs/cli/debug.py index d19b0aa2ae276..4154514b4379a 100644 --- a/eden/fs/cli/debug.py +++ b/eden/fs/cli/debug.py @@ -1360,17 +1360,14 @@ def upload_logs( proc: Optional[subprocess.Popen] = None if rage_processor and not args.stdout: proc = subprocess.Popen(shlex.split(rage_processor), stdin=subprocess.PIPE) - sink = proc.stdin + sink = rage_mod.IOWithRedaction(cast(IO[bytes], proc.stdin)) else: proc = None - sink = sys.stdout.buffer + sink = rage_mod.IOWithRedaction(sys.stdout.buffer) - # pyre-fixme[6]: Expected `IO[bytes]` for 2nd param but got - # `Optional[typing.IO[typing.Any]]`. rage_mod.print_log_file(eden_log_path, sink, args.full, args.size) if proc: - # pyre-fixme[16]: `Optional` has no attribute `close`. - sink.close() + sink.wrapped.close() proc.wait() return 0