From 83bfa73ec2f591ec75d20f017158fb6359d4976e Mon Sep 17 00:00:00 2001 From: Luke Hackwell Date: Tue, 22 Apr 2025 10:03:19 +0100 Subject: [PATCH] fix(localhost): fix issue where labgrid_test times out when the src is a py_binary named "env" and the localhost platform is used. --- bazel/labgrid/driver/localhost.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bazel/labgrid/driver/localhost.py b/bazel/labgrid/driver/localhost.py index ed74c388..0ee707f5 100644 --- a/bazel/labgrid/driver/localhost.py +++ b/bazel/labgrid/driver/localhost.py @@ -28,6 +28,7 @@ class LocalhostDriver(CommandMixin, Driver, CommandProtocol, FileTransferProtoco def _run(self, cmd, *, timeout=30.0, codec="utf-8", decodeerrors="strict"): env = exclude_runfile_env_vars(environ) + self._fix_env_path(env) process = run( cmd, stdout=PIPE, @@ -60,3 +61,11 @@ class LocalhostDriver(CommandMixin, Driver, CommandProtocol, FileTransferProtoco copytree(source, destination) else: copy(source, destination) + + def _fix_env_path(self, env): + """Fixes bug caused by cwd being in path when bazel test is ran. + + See https://gitlab.arm.com/bazel/rules_labgrid/-/issues/58. + """ + if "PATH" in env: + env["PATH"] = env["PATH"].replace(".:", "") -- GitLab