From d6a7a6bd9c7f183a7712731ac3e32e997fdd9135 Mon Sep 17 00:00:00 2001 From: "wnwen@chromium.org" Date: Tue, 29 Apr 2025 12:32:32 -0700 Subject: [PATCH] android: Allow anonymous pipes for benchmarking In a typical scenario we would not want to run the build server if autoninja is run as part of a script (see https://crrev.com/c/6278629), but specifically for benchmarking, we want to allow callers who explicitly set AUTONINJA_STDOUT_NAME to still run the build server, as these callers need the build server to run to properly time and benchmark, even if all the output is discarded. R=agrieve@chromium.org Bug: 393136861 Change-Id: I97f556c2238eacc5cc8240287f4c6da0160efb71 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6499328 Reviewed-by: Andrew Grieve Commit-Queue: Peter Wen Auto-Submit: Peter Wen --- android_build_server_helper.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/android_build_server_helper.py b/android_build_server_helper.py index 8378c894cd..319f0b6490 100644 --- a/android_build_server_helper.py +++ b/android_build_server_helper.py @@ -51,6 +51,10 @@ def _start_server(local_dev_server_path): def _set_tty_env(): + # If the caller explicitly set this environment variable, just use it + # instead of failing. + if "AUTONINJA_STDOUT_NAME" in os.environ: + return True stdout_name = os.readlink('/proc/self/fd/1') # Anonymous pipes can't be opened. These look like "pipe:[394765110]". ret = os.path.exists(stdout_name)