diff --git a/bazel/labgrid/driver/localhost.py b/bazel/labgrid/driver/localhost.py index ed74c388eadd6e0d07737c43ec8a96326ea0e60f..0ee707f524bc70fd862331b5f66db3beebf00363 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(".:", "")