diff --git a/bazel/labgrid/runner/runner.py b/bazel/labgrid/runner/runner.py index 8dc11452f07502ad86c098b24b9a2eb1261255e3..8905e2af6836fdebcb9b4eab147be0bdea1775fc 100644 --- a/bazel/labgrid/runner/runner.py +++ b/bazel/labgrid/runner/runner.py @@ -113,7 +113,7 @@ class Runner: def run(self, cmd: str, env: Mapping[str, str] = {}) -> int: """Run a command on the device with given environment variables.""" cmd = f"cd {self._exec_root} && {self._tools.env(env, cmd)}" - out, err, code = self._shell.run(cmd) + out, err, code = self._run(cmd, check=False) for line in out: stdout.write(f"{line}{linesep}") for line in err: @@ -155,7 +155,9 @@ class Runner: return path def _run(self, cmd, check=True): - out, err, code = self._shell.run(cmd) + # We should let Bazel kill the process with the configured timeout if running a test + timeout = None if environ.get("BAZEL_TEST") == "1" else 30 + out, err, code = self._shell.run(cmd, timeout=timeout) if check and code: raise CalledProcessError( cmd=cmd, returncode=code, output=stdout, stderr=err