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
This commit is contained in:
Genevieve Helsel 2020-10-13 12:14:11 -07:00 committed by Facebook GitHub Bot
parent 7aab3c4f85
commit 82199a1818

View File

@ -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