From 182e89d024bf6b9cdec9ba712d7cd9e76804e0f3 Mon Sep 17 00:00:00 2001 From: Alex Tercete Date: Wed, 30 Apr 2025 19:52:20 +0100 Subject: [PATCH] fix(LocalhostDriver): use clean env We're trying to simulate a remote device, so we shouldn't inherit env vars from the Bazel process as it can lead to false positives in tests. --- bazel/labgrid/driver/localhost.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bazel/labgrid/driver/localhost.py b/bazel/labgrid/driver/localhost.py index ed74c388..e97a307f 100644 --- a/bazel/labgrid/driver/localhost.py +++ b/bazel/labgrid/driver/localhost.py @@ -1,11 +1,10 @@ import attr -from os import environ, linesep +from os import linesep from shutil import copy, copytree from subprocess import run, PIPE from pathlib import Path -from bazel.python.runfiles import exclude_runfile_env_vars from labgrid.factory import target_factory from labgrid.step import step from labgrid.driver import Driver @@ -27,12 +26,11 @@ class LocalhostDriver(CommandMixin, Driver, CommandProtocol, FileTransferProtoco return self._run(cmd, timeout=timeout, codec=codec, decodeerrors=decodeerrors) def _run(self, cmd, *, timeout=30.0, codec="utf-8", decodeerrors="strict"): - env = exclude_runfile_env_vars(environ) process = run( cmd, stdout=PIPE, stderr=PIPE, - env=env, + env={}, shell=True, timeout=timeout, encoding=codec, -- GitLab