From: Scott Gasch Date: Fri, 3 Jun 2022 02:51:18 +0000 (-0700) Subject: Update docs. X-Git-Url: https://wannabe.guru.org/gitweb/?a=commitdiff_plain;h=6ffc731986c436824e20d1635a532d9335d724d3;p=python_utils.git Update docs. --- diff --git a/exec_utils.py b/exec_utils.py index 0bcfc27..51aaeb4 100644 --- a/exec_utils.py +++ b/exec_utils.py @@ -72,10 +72,9 @@ def cmd_showing_output( def cmd_exitcode(command: str, timeout_seconds: Optional[float] = None) -> int: - """Run a command but do not let it run for more than timeout_seconds. - This code doesn't capture or rebroadcast the command's output. It - returns the exit value of the command or raises a TimeoutExpired - exception if the deadline is exceeded. + """Run a command silently and return its exit code once it has + finished. If timeout_seconds is provided and the command runs too + long it will raise a TimeoutExpired exception. Args: command: the command to run @@ -99,9 +98,9 @@ def cmd_exitcode(command: str, timeout_seconds: Optional[float] = None) -> int: def cmd(command: str, timeout_seconds: Optional[float] = None) -> str: - """Run a command and capture its output to stdout (only) into a string - buffer. Return that string as this function's output. Raises - subprocess.CalledProcessError or TimeoutExpired on error. + """Run a command and capture its output to stdout and stderr into a + string buffer. Return that string as this function's output. + Raises subprocess.CalledProcessError or TimeoutExpired on error. Args: command: the command to run @@ -133,7 +132,7 @@ def cmd(command: str, timeout_seconds: Optional[float] = None) -> str: def run_silently(command: str, timeout_seconds: Optional[float] = None) -> None: """Run a command silently but raise subprocess.CalledProcessError if - it fails. + it fails and raise a TimeoutExpired if it runs too long. Args: command: the command to run