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:
)
-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(
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: