当前位置: 首页>>代码示例>>Java>>正文


Java ExecResult类代码示例

本文整理汇总了Java中jetbrains.buildServer.ExecResult的典型用法代码示例。如果您正苦于以下问题:Java ExecResult类的具体用法?Java ExecResult怎么用?Java ExecResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ExecResult类属于jetbrains.buildServer包,在下文中一共展示了ExecResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
 
开发者ID:JetBrains,项目名称:teamcity-symbol-server,代码行数:25,代码来源:JetSymbolsExe.java

示例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();
}
 
开发者ID:jonnyzzz,项目名称:TeamCity.Virtual,代码行数:18,代码来源:UserUIDAndGIDImpl.java

示例3: processExecStep

import jetbrains.buildServer.ExecResult; //导入依赖的package包/类
private void processExecStep(SoftInstallExecStep step)
        throws SoftInstallException
{
  final String cmdLine = step.getCmdLine();
  myBuildLogger.message("RUNNING: " + cmdLine);

  ExecResult result = runCommand(cmdLine);
  final int exitCode = result.getExitCode();

  final String stdout = result.getStdout();
  if (stdout.length() > 0) {
    logMessage(stdout);
  }

  final String stderr = result.getStderr();
  if (stderr.length() > 0) {
    if (exitCode != 0) myBuildLogger.error(stderr);
    else logMessage(stderr);
  }

  if (exitCode != 0) {
    throw new SoftInstallException("Exit code "+ exitCode +" from process: " + cmdLine);
  }
}
 
开发者ID:leo-from-spb,项目名称:teamcity-soft-installer,代码行数:25,代码来源:SoftInstallSession.java

示例4: runCommand

import jetbrains.buildServer.ExecResult; //导入依赖的package包/类
ExecResult runCommand(@NotNull String commandLine)
        throws SoftInstallException
{
  Pair<File,String> systemCommandInterpreter = getSystemCommandIntepreter();
  if (!systemCommandInterpreter.first.isFile()) {
    throw new SoftInstallException("System command interpreter not found: " + systemCommandInterpreter);
  }

  final List<String> givenArgs = parseCommandLine(commandLine);

  ArrayList<String> allArgs = new ArrayList<String>(givenArgs.size()+1);
  allArgs.add(systemCommandInterpreter.second);
  allArgs.addAll(givenArgs);

  try {
    return runExeFile(systemCommandInterpreter.first, allArgs, null);
  }
  catch (ExecutionException ee) {
    throw new SoftInstallException("Failed to run: " + commandLine);
  }
}
 
开发者ID:leo-from-spb,项目名称:teamcity-soft-installer,代码行数:22,代码来源:SoftInstallSession.java

示例5: enableExecution

import jetbrains.buildServer.ExecResult; //导入依赖的package包/类
private static void enableExecution(@NotNull final File filePath) {
  final GeneralCommandLine commandLine = new GeneralCommandLine();
  
  commandLine.setExePath("chmod");
  commandLine.addParameter("+x");
  commandLine.addParameter(filePath.getName());
  commandLine.setWorkDirectory(filePath.getParent());

  final ExecResult execResult = SimpleCommandLineProcessRunner.runCommand(commandLine, null);
  if (execResult.getExitCode() != 0) {
    LOG.warn("Failed to set executable attribute for " + filePath + ": chmod +x exit code is " + execResult.getExitCode());
  }
}
 
开发者ID:JetBrains,项目名称:teamcity-powershell,代码行数:14,代码来源:PowerShellServiceUnix.java

示例6: isExistedTool

import jetbrains.buildServer.ExecResult; //导入依赖的package包/类
/**
 * Returns True if Existed Tool myConfigName
 * @return
 */
public boolean isExistedTool(){
  final GeneralCommandLine commandLine = new GeneralCommandLine();
  commandLine.setExePath(myToolName);
  commandLine.addParameter(myVersionArg);
  final ExecResult execResult = SimpleCommandLineProcessRunner.runCommand(commandLine, (byte[])null);
  if (execResult.getExitCode() == 0){
    myVersion = findVersion(stringArrayToString(execResult.getOutLines()));
  }
  return execResult.getExitCode() == 0;
}
 
开发者ID:unix-junkie,项目名称:teamcity-autotools-plugin,代码行数:15,代码来源:AutotoolsToolProvider.java

示例7: enableExecution

import jetbrains.buildServer.ExecResult; //导入依赖的package包/类
/**
 * Set executable attribute for file.
 * @param filePath File to be setted executable attribute
 * @param baseDir Directory to be setted Work Directory
 */
private static void enableExecution(@NotNull final String filePath, @NotNull final String baseDir) {
  final GeneralCommandLine commandLine = new GeneralCommandLine();
  commandLine.setExePath("chmod");
  commandLine.addParameter("+x");
  commandLine.addParameter(filePath);
  commandLine.setWorkDirectory(baseDir);
  final ExecResult execResult = SimpleCommandLineProcessRunner.runCommand(commandLine, null);
  if(execResult.getExitCode() != 0) {
    Loggers.AGENT.warn("Failed to set executable attribute for " + filePath + ": chmod +x exit code is " + execResult.getExitCode());
  }
}
 
开发者ID:unix-junkie,项目名称:teamcity-autotools-plugin,代码行数:17,代码来源:AutotoolsBuildCLBService.java

示例8: doCommand

import jetbrains.buildServer.ExecResult; //导入依赖的package包/类
public ExecResult doCommand(final PdbStrExeCommands cmd, final File pdbFile, final File inputStreamFile, final String streamName){
  final GeneralCommandLine commandLine = new GeneralCommandLine();
  commandLine.setWorkDirectory(myPath.getParent());
  commandLine.setExePath(myPath.getPath());
  commandLine.addParameter(cmd.getCmdSwitch());
  commandLine.addParameter(String.format("%s:%s", PATH_TO_PDB_FILE_SWITCH, pdbFile.getAbsolutePath()));
  commandLine.addParameter(String.format("%s:%s", PATH_TO_INPUT_FILE_SWITCH, inputStreamFile.getAbsolutePath()));
  commandLine.addParameter(STREAM_NAME_SWITCH + ":" + streamName);
  return SimpleCommandLineProcessRunner.runCommand(commandLine, null);
}
 
开发者ID:JetBrains,项目名称:teamcity-symbol-server,代码行数:11,代码来源:PdbStrExe.java

示例9: getReferencedSourceFiles

import jetbrains.buildServer.ExecResult; //导入依赖的package包/类
public Collection<File> getReferencedSourceFiles(File symbolsFile) {
  final GeneralCommandLine commandLine = new GeneralCommandLine();
  commandLine.setExePath(mySrcToolPath.getPath());
  commandLine.addParameter(symbolsFile.getAbsolutePath());
  commandLine.addParameter(DUMP_SOURCES_FROM_PDB_SWITCH);
  final ExecResult execResult = SimpleCommandLineProcessRunner.runCommand(commandLine, null);
  return CollectionsUtil.convertAndFilterNulls(Arrays.asList(execResult.getOutLines()), new Converter<File, String>() {
    public File createFrom(@NotNull String source) {
      final File file = new File(source);
      if (file.isFile()) return file;
      return null; //last string is not a source file path
    }
  });
}
 
开发者ID:JetBrains,项目名称:teamcity-symbol-server,代码行数:15,代码来源:SrcToolExe.java

示例10: testRead

import jetbrains.buildServer.ExecResult; //导入依赖的package包/类
@Test
public void testRead() throws Exception {
  final File tempFile = createTempFile();
  assertTrue(tempFile.length() == 0);
  ExecResult execResult = myTool.doCommand(PdbStrExeCommands.READ, myIndexedPdbFile, tempFile, PdbStrExe.SRCSRV_STREAM_NAME);
  assertEquals(0, execResult.getExitCode());
  assertFalse(tempFile.length() == 0);
}
 
开发者ID:JetBrains,项目名称:teamcity-symbol-server,代码行数:9,代码来源:PdbStrExeTest.java

示例11: processResult

import jetbrains.buildServer.ExecResult; //导入依赖的package包/类
private Result<AccessControlEntry, Boolean> processResult(@NotNull final AccessControlEntry entry, @NotNull final ExecResult result) {
  if(result.getExitCode() != 0) {
    final String resultStr = result.toString();
    LOG.warn(resultStr);
    return new Result<AccessControlEntry, Boolean>(entry, false);
  }

  return new Result<AccessControlEntry, Boolean>(entry, true);
}
 
开发者ID:JetBrains,项目名称:teamcity-runas-plugin,代码行数:10,代码来源:WindowsFileAccessService.java

示例12: tryExecChmod

import jetbrains.buildServer.ExecResult; //导入依赖的package包/类
@Nullable
private Result<AccessControlEntry, Boolean> tryExecChmod(@NotNull final AccessControlEntry entry, @NotNull final Iterable<String> chmodPermissions)
{
  final String chmodPermissionsStr = StringUtil.join("", chmodPermissions);
  if(StringUtil.isEmptyOrSpaces(chmodPermissionsStr)) {
    return null;
  }

  final ArrayList<CommandLineArgument> args = new ArrayList<CommandLineArgument>();
  if (entry.getPermissions().contains(AccessPermissions.Recursive)) {
    args.add(new CommandLineArgument("-R", CommandLineArgument.Type.PARAMETER));
  }
  args.add(new CommandLineArgument(chmodPermissionsStr, CommandLineArgument.Type.PARAMETER));
  args.add(new CommandLineArgument(entry.getFile().getAbsolutePath(), CommandLineArgument.Type.PARAMETER));
  final CommandLineSetup chmodCommandLineSetup = new CommandLineSetup(CHMOD_TOOL_NAME, args, Collections.<CommandLineResource>emptyList());
  try {
    final ExecResult result = myCommandLineExecutor.runProcess(chmodCommandLineSetup, EXECUTION_TIMEOUT_SECONDS);
    if(result == null) {
      return null;
    }

    return processResult(entry, result);
  }
  catch (ExecutionException e) {
    LOG.error(e);
    return new Result<AccessControlEntry, Boolean>(entry, e);
  }
}
 
开发者ID:JetBrains,项目名称:teamcity-runas-plugin,代码行数:29,代码来源:LinuxFileAccessService.java

示例13: runExeFile

import jetbrains.buildServer.ExecResult; //导入依赖的package包/类
static ExecResult runExeFile(final @NotNull File exeFile,
                             final @Nullable List<String> args,
                             final @Nullable String inputText)
        throws ExecutionException
{
  GeneralCommandLine cmdLine = new GeneralCommandLine();
  cmdLine.setExePath(exeFile.getAbsolutePath());
  cmdLine.setPassParentEnvs(true);
  if (args != null)
      cmdLine.addParameters(args);

  final byte[] input = inputText != null
          ? inputText.getBytes()
          : new byte[0];

  try
  {
    ExecResult execResult;
    final Thread currentThread = Thread.currentThread();
    final String threadName = currentThread.getName();
    final String newThreadName = "SoftInstall: waiting for: " + cmdLine.getCommandLineString();
    currentThread.setName(newThreadName);
    try
    {
      execResult = SimpleCommandLineProcessRunner.runCommand(cmdLine, input);
    }
    finally
    {
      currentThread.setName(threadName);
    }
    return execResult;
  }
  catch (Exception e)
  {
    throw new ExecutionException(e.getMessage(), e);
  }
}
 
开发者ID:leo-from-spb,项目名称:teamcity-soft-installer,代码行数:38,代码来源:SoftInstallSession.java

示例14: runProcess

import jetbrains.buildServer.ExecResult; //导入依赖的package包/类
@Nullable
public ExecResult runProcess(@NotNull final CommandLineSetup commandLineSetup, final int executionTimeoutSeconds) throws ExecutionException {
  final GeneralCommandLine cmd = new GeneralCommandLine();
  cmd.setExePath(commandLineSetup.getToolPath());
  for (CommandLineArgument arg: commandLineSetup.getArgs()) {
    cmd.addParameter(arg.getValue());
  }

  try {
    LOG.info("Exec: " + cmd.getCommandLineString());
    final jetbrains.buildServer.CommandLineExecutor executor = new jetbrains.buildServer.CommandLineExecutor(cmd);
    final ExecResult result = executor.runProcess(executionTimeoutSeconds);
    if(LOG.isDebugEnabled()) {
      StringBuilder resultStr = new StringBuilder();
      if (result != null) {
        resultStr.append("exit code: ");
        resultStr.append(result.getExitCode());
        final String[] outLines = result.getOutLines();
        if (outLines != null) {
          resultStr.append("out: ");
          for (String line : outLines) {
            if (!StringUtil.isEmpty(line)) {
              resultStr.append(line);
            }

            resultStr.append(LINE_SEPARATOR);
          }
        }
      } else {
        resultStr.append("has no result");
      }

      LOG.debug("Result: " + resultStr);
    }

    return result;
  }
  catch (RuntimeException ex) {
    throw new ExecutionException(ex.getMessage());
  }
}
 
开发者ID:JetBrains,项目名称:teamcity-runas-plugin,代码行数:42,代码来源:CommandLineExecutorImpl.java

示例15: runProcess

import jetbrains.buildServer.ExecResult; //导入依赖的package包/类
@Nullable
ExecResult runProcess(@NotNull final CommandLineSetup commandLineSetup, final int executionTimeoutSeconds) throws ExecutionException;
 
开发者ID:JetBrains,项目名称:teamcity-runas-plugin,代码行数:3,代码来源:CommandLineExecutor.java


注:本文中的jetbrains.buildServer.ExecResult类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。