pyacs.lib.syscmd

Runs a system commands

exception pyacs.lib.syscmd.Error[source]

Bases: Exception

Base class for exceptions in module syscmd.

exception pyacs.lib.syscmd.ReturnedCodeError[source]

Bases: Exception

Exception raised for returned code not 0.

pyacs.lib.syscmd.getstatusoutput(cmd, verbose=False)[source]

Run a shell command and raise if return code is non-zero.

Parameters:
  • cmd (str) – Shell command string.

  • verbose (bool, optional) – If True, print command and stdout. Default is False.

Raises:

ReturnedCodeError – If the command returns a non-zero exit code.

pyacs.lib.syscmd.run_command_verbose(command)[source]

Run a command and stream stdout line by line.

Parameters:

command (str) – Shell command string.

Returns:

Return code of the process.

Return type:

int