Add --run_profiler option.
[python_utils.git] / exec_utils.py
index 016310793152ddeb8872f5ec279c26ae1994655e..282a325a461e289144b5a58b5a88ce4a90098c83 100644 (file)
@@ -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: