diff options
Diffstat (limited to 'exec_utils.py')
| -rw-r--r-- | exec_utils.py | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/exec_utils.py b/exec_utils.py index 0163107..282a325 100644 --- a/exec_utils.py +++ b/exec_utils.py @@ -68,9 +68,7 @@ def cmd_with_timeout(command: str, timeout_seconds: Optional[float]) -> int: subprocess.TimeoutExpired: Command '['/bin/bash', '-c', '/bin/sleep 2']' timed out after 0.1 seconds """ - return subprocess.check_call( - ["/bin/bash", "-c", command], timeout=timeout_seconds - ) + return subprocess.check_call(["/bin/bash", "-c", command], timeout=timeout_seconds) def cmd(command: str, timeout_seconds: Optional[float] = None) -> str: @@ -120,9 +118,7 @@ def run_silently(command: str, timeout_seconds: Optional[float] = None) -> None: ) -def cmd_in_background( - command: str, *, silent: bool = False -) -> subprocess.Popen: +def cmd_in_background(command: str, *, silent: bool = False) -> subprocess.Popen: args = shlex.split(command) if silent: subproc = subprocess.Popen( @@ -137,9 +133,7 @@ def cmd_in_background( def kill_subproc() -> None: try: if subproc.poll() is None: - logger.info( - "At exit handler: killing {}: {}".format(subproc, command) - ) + logger.info("At exit handler: killing {}: {}".format(subproc, command)) subproc.terminate() subproc.wait(timeout=10.0) except BaseException as be: |
