diff options
| author | Scott Gasch <[email protected]> | 2022-06-02 19:51:18 -0700 |
|---|---|---|
| committer | Scott Gasch <[email protected]> | 2022-06-02 19:51:18 -0700 |
| commit | 6ffc731986c436824e20d1635a532d9335d724d3 (patch) | |
| tree | 2a036f834e9c6baf17604328d39e7baa17638f3f | |
| parent | a9bdfd8fc9f84b7b2c09a57cd12ba32259e84d1c (diff) | |
Update docs.
| -rw-r--r-- | exec_utils.py | 15 |
1 files changed, 7 insertions, 8 deletions
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 |
