runExternal

lsst.sconsUtils.utils.runExternal(cmd, fatal=False, msg=None)

Safe wrapper for running external programs, reading stdout, and sanitizing error messages.

Parameters:
cmd : str or list or tuple

Command to execute. Shell usage is disabled if a sequence is given. Shell is used if a single command string is given.

fatal : bool, optional

Control whether command failure is fatal or not.

msg : str

Message to report on command failure.

Returns:
output : str

Entire program output is returned, not just a single line.

Raises:
RuntimeError

If the command fails and fatal is True.