pyacs.lib.utils.run_cmd
Subprocess helpers.
- pyacs.lib.utils.run_cmd.run_cmd(cmd, shell=True, check=True, capture_output=True, text=True)[source]
Run a command using subprocess and check for errors.
- Parameters:
cmd (str or list) – Command to run. If str, will be run with shell=True
shell (bool, optional) – Whether to use shell. Default is True
check (bool, optional) – Whether to raise CalledProcessError if return code is non-zero. Default is True
capture_output (bool, optional) – Whether to capture stdout and stderr. Default is True
text (bool, optional) – Whether to return output as string. Default is True
- Returns:
Object containing returncode, stdout, stderr
- Return type:
subprocess.CompletedProcess
- Raises:
subprocess.CalledProcessError – If check=True and command returns non-zero exit code