From 82199a181840e8deaa8cc8a2b6db9e690e0d9f3d Mon Sep 17 00:00:00 2001 From: Genevieve Helsel Date: Tue, 13 Oct 2020 12:14:11 -0700 Subject: [PATCH] add stderr option for eden rage Summary: Add option to redirect the eden rage output to stderr Reviewed By: chadaustin Differential Revision: D24210031 fbshipit-source-id: 736af81de6a41e49c2459a1cd8124123d6928323 --- eden/fs/cli/main.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/eden/fs/cli/main.py b/eden/fs/cli/main.py index bb2ef15677..ff8016ed68 100644 --- a/eden/fs/cli/main.py +++ b/eden/fs/cli/main.py @@ -1630,6 +1630,11 @@ class RageCmd(Subcmd): action="store_true", help="Print the rage report to stdout: ignore reporter.", ) + parser.add_argument( + "--stderr", + action="store_true", + help="Print the rage report to stderr: ignore reporter.", + ) def run(self, args: argparse.Namespace) -> int: instance = get_eden_instance(args) @@ -1637,9 +1642,12 @@ class RageCmd(Subcmd): rage_processor = instance.get_config_value("rage.reporter", default="") proc: Optional[subprocess.Popen] = None - if rage_processor and not args.stdout: + if rage_processor and not args.stdout and not args.stderr: proc = subprocess.Popen(shlex.split(rage_processor), stdin=subprocess.PIPE) sink = proc.stdin + elif args.stderr: + proc = None + sink = sys.stderr.buffer else: proc = None sink = sys.stdout.buffer