throws IOException, InterruptedException, NonZeroExitCodeException {
CollectLogPolicy localCollector = new CollectLogPolicy(logger);
command = Templates.getTemplateResult(command, templateDefaults);
LocalCommand localCmd = localCommandFactory.create(localCollector, command);
if(localCmd.getExitCode() != 0) {
throw new NonZeroExitCodeException(String.format(
"Command '%s' failed with exit status %d and output '%s'",
command, localCmd.getExitCode(), localCollector.getOutput()));
}
}