call_proc

getmac.utils.call_proc(executable, args)[source]

Wrapper around subprocess.check_output() with some logging and type conversion.

The reason this and getmac.utils.popen() are separate functions is to make it easier to mock for unit tests.

Parameters:
  • executable (str) – command to run

  • args (str) – arguments to the command

Return type:

str

Returns:

stdout from the command (stderr is discarded)

Raises:

CalledProcessError – the command failed to execute