本文整理汇总了Java中jetbrains.buildServer.ExecResult.getException方法的典型用法代码示例。如果您正苦于以下问题:Java ExecResult.getException方法的具体用法?Java ExecResult.getException怎么用?Java ExecResult.getException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jetbrains.buildServer.ExecResult
的用法示例。
在下文中一共展示了ExecResult.getException方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dumpPdbGuidsToFile
import jetbrains.buildServer.ExecResult; //导入方法依赖的package包/类
public int dumpPdbGuidsToFile(Collection<File> files, File output, BuildProgressLogger buildLogger) throws IOException {
final GeneralCommandLine commandLine = new GeneralCommandLine();
commandLine.setExePath(myExePath.getPath());
commandLine.addParameter(DUMP_SYMBOL_SIGN_CMD);
commandLine.addParameter(String.format("/o=%s", output.getPath()));
commandLine.addParameter(String.format("/i=%s", dumpPathsToFile(files).getPath()));
buildLogger.message(String.format("Running command %s", commandLine.getCommandLineString()));
final ExecResult execResult = SimpleCommandLineProcessRunner.runCommand(commandLine, null);
final String stdout = execResult.getStdout();
if(!stdout.isEmpty()){
buildLogger.message("Stdout: " + stdout);
}
final int exitCode = execResult.getExitCode();
if (exitCode != 0) {
buildLogger.warning(String.format("%s ends with non-zero exit code %s.", SYMBOLS_EXE, execResult));
buildLogger.warning("Stdout: " + stdout);
buildLogger.warning("Stderr: " + execResult.getStderr());
final Throwable exception = execResult.getException();
if(exception != null){
buildLogger.exception(exception);
}
}
return exitCode;
}
示例2: runCommand
import jetbrains.buildServer.ExecResult; //导入方法依赖的package包/类
@Nullable
private String runCommand(@NotNull String command) {
final GeneralCommandLine cmd = new GeneralCommandLine();
cmd.setExePath("/bin/sh");
cmd.addParameter("-c");
cmd.addParameter(command);
final ExecResult result = SimpleCommandLineProcessRunner.runCommand(cmd, new byte[0]);
//noinspection ThrowableResultOfMethodCallIgnored
if (result.getException() != null || result.getExitCode() != 0) {
LOG.info(("Failed to call '" + command+ "'. Exit code: " + result.getExitCode() + "\n " + result.getStdout() + "\n" + result.getStderr()).trim());
return null;
}
return result.getStdout().trim();
}