(cmd, cwd=None)
return out
execute a command, raising a ShellCommandError if any error occurs.
    return stdout otherwise. stderr is logged if no error occurs.
execute a command, raising a ShellCommandError if any error occurs.
    return stdout otherwise. stderr is logged if no error occurs.
execute a command raising a ShellCommandError if any error occurs . return stdout otherwise . stderr is logged if no error occurs .
def shell_exec_checked(cmd, cwd=None):
    """execute a command, raising a ShellCommandError if any error occurs.
    return stdout otherwise. stderr is logged if no error occurs."""
    try:
        retcode, out, err = shell_exec_raw(cmd, cwd)
    except Exception as e:
        #not terribly sure what exceptions can occur when executing via shell.
        #maybe if the shell itself is missing. playing it safe anyway...
        raise ShellCommandError(ex=e)

    if retcode != 0:
        raise ShellCommandError(**locals())

    if err:
        logging.warn('command [%s] returned error output %s (return code OK)' % (cmd, str(err)))
    return out
def shell_exec_checked ( cmd , cwd = None ) : try : retcode , out , err = shell_exec_raw ( cmd , cwd ) except Exception as e : #not terribly sure what exceptions can occur when executing via shell. #maybe if the shell itself is missing. playing it safe anyway... raise ShellCommandError ( ex = e ) if retcode != 0 : raise ShellCommandError ( * * locals ( ) ) if err : logging . warn ( 'command [%s] returned error output %s (return code OK)' % ( cmd , str ( err ) ) ) return out