nixos/test-driver: add timeout parameter to execute
This commit is contained in:
parent
51befa6cdc
commit
363d7f3ae8
@ -597,9 +597,14 @@ class Machine:
|
||||
break
|
||||
return "".join(output_buffer)
|
||||
|
||||
def execute(self, command: str, check_return: bool = True) -> Tuple[int, str]:
|
||||
def execute(
|
||||
self, command: str, check_return: bool = True, timeout: Optional[int] = 900
|
||||
) -> Tuple[int, str]:
|
||||
self.connect()
|
||||
|
||||
if timeout is not None:
|
||||
command = "timeout {} sh -c {}".format(timeout, shlex.quote(command))
|
||||
|
||||
out_command = f"( set -euo pipefail; {command} ) | (base64 --wrap 0; echo)\n"
|
||||
assert self.shell
|
||||
self.shell.send(out_command.encode())
|
||||
|
Loading…
Reference in New Issue
Block a user