Search in sources :

Example 1 with Exec

use of com.emc.storageos.services.util.Exec in project coprhd-controller by CoprHD.

the class LocalRepository method exec.

private static String[] exec(final String prefix, String outputMaskPatternStr, String[] cmd) throws LocalRepositoryException {
    Pattern maskFilter = null;
    if (!StringUtils.isEmpty(outputMaskPatternStr)) {
        maskFilter = Pattern.compile(outputMaskPatternStr);
    }
    final Exec.Result result = Exec.sudo(_SYSTOOL_TIMEOUT, maskFilter, cmd);
    if (!result.exitedNormally() || result.getExitValue() != 0) {
        _log.info(prefix + "Command failed. Result exit value: " + result.getExitValue());
        throw SyssvcException.syssvcExceptions.localRepoError(prefix + "Command failed: " + result);
    }
    return result.getStdOutput().split(LINE_DELIMITER);
}
Also used : Exec(com.emc.storageos.services.util.Exec) Pattern(java.util.regex.Pattern)

Aggregations

Exec (com.emc.storageos.services.util.Exec)1 Pattern (java.util.regex.Pattern)1