org.apache.commons.exec.Executor.setExitValue()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(110)

本文整理了Java中org.apache.commons.exec.Executor.setExitValue()方法的一些代码示例,展示了Executor.setExitValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Executor.setExitValue()方法的具体详情如下:
包路径:org.apache.commons.exec.Executor
类名称:Executor
方法名:setExitValue

Executor.setExitValue介绍

[英]Define the exitValue of the process to be considered successful. If a different exit value is returned by the process then org.apache.commons.exec.Executor#execute(CommandLine)will throw an org.apache.commons.exec.ExecuteException
[中]定义要被视为成功的流程的exitValue。如果流程返回不同的退出值,则返回org。阿帕奇。平民执行官。Executor#execute(命令行)将抛出一个组织。阿帕奇。平民执行官。执行异常

代码示例

代码示例来源:origin: openhab/openhab1-addons

PumpStreamHandler streamHandler = new PumpStreamHandler(stdout);
executor.setExitValue(1);
executor.setStreamHandler(streamHandler);
executor.setWatchdog(watchdog);

代码示例来源:origin: ru.yandex.qatools.camelot/camelot-utils

/**
 * Create {@link org.apache.commons.exec.Executor} with infinite timeout watchdog
 *
 * @return created executor
 */
public static Executor createExecutor() {
  ExecuteWatchdog watchdog = new ExecuteWatchdog(INFINITE_TIMEOUT);
  Executor executor = new DefaultExecutor();
  executor.setExitValue(1);
  executor.setWatchdog(watchdog);
  return executor;
}

代码示例来源:origin: alexholmes/hdfs-file-slurper

executor.setExitValue(0);

代码示例来源:origin: gov.nasa.jpl.imce/gov.nasa.jpl.magicdraw.projectUsageIntegrityChecker

executor.setExitValue(0);
executor.setWatchdog(watchdog);
executor.setWorkingDirectory(pugTemp);

代码示例来源:origin: ga4gh/dockstore

executor.setWorkingDirectory(workingDir);
executor.setExitValue(0);
if (dumpOutput) {
  LOG.info("CMD: " + command);

代码示例来源:origin: com.github.becausetesting/commons

/**
 * Execute a command on the operating system using Apache Commons Exec. This
 * function runs asynchronously and dumps both stderr and stdout streams to
 * a temp file.
 *
 * @param commandLine
 *            The command to be executed.
 * @param outputStreamHandler
 *            An output stream to dump the process stderr and stdout to it.
 */
public static void runCommandUsingApacheExec(CommandLine commandLine, OutputStream outputStreamHandler) {
  try {
    DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
    PumpStreamHandler streamHandler = new PumpStreamHandler(outputStreamHandler);
    logger.info("commandLine: " + commandLine.toString());
    Executor process = new DefaultExecutor();
    process.setExitValue(0);
    process.setStreamHandler(streamHandler);
    process.execute(commandLine, resultHandler);
    // resultHandler.waitFor();
  } catch (Exception ex) {
    logger.error("An exception was thrown.", ex);
  }
}

代码示例来源:origin: com.github.becauseQA/becauseQA-utils

/**
 * Execute a command on the operating system using Apache Commons Exec. This
 * function runs asynchronously and dumps both stderr and stdout streams to
 * a temp file.
 *
 * @param commandLine
 *            The command to be executed.
 * @param outputStreamHandler
 *            An output stream to dump the process stderr and stdout to it.
 */
public static void runCommandUsingApacheExec(CommandLine commandLine, OutputStream outputStreamHandler) {
  try {
    DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
    PumpStreamHandler streamHandler = new PumpStreamHandler(outputStreamHandler);
    logger.info("commandLine: " + commandLine.toString());
    Executor process = new DefaultExecutor();
    process.setExitValue(0);
    process.setStreamHandler(streamHandler);
    process.execute(commandLine, resultHandler);
    // resultHandler.waitFor();
  } catch (Exception ex) {
    logger.error("An exception was thrown.", ex);
  }
}

代码示例来源:origin: com.hurence.logisland/logisland-agent

PumpStreamHandler psh = new PumpStreamHandler(stdout);
Executor executor = new DefaultExecutor();
executor.setExitValue(0);
executor.setStreamHandler(psh);
try {
  killCmdLine.addArgument(app.getId());
  Executor killExecutor = new DefaultExecutor();
  killExecutor.setExitValue(0);
  try {
    killExecutor.execute(killCmdLine);

代码示例来源:origin: net.jangaroo/jangaroo-maven-plugin

private static void internalExecute(CommandLine cmdLine, OutputStream outputStream, File workingDirectory) throws IOException {
 Executor executor = getExecutor();
 ExecuteWatchdog watchdog = getExecuteWatchdog();
 executor.setWatchdog(watchdog);
 if (workingDirectory != null) {
  executor.setWorkingDirectory(workingDirectory);
 }
 // set allowed exit values (0 is actually the default)
 executor.setExitValue(0);
 PumpStreamHandler psh = new PumpStreamHandler(outputStream);
 executor.setStreamHandler(psh);
 executor.execute(cmdLine);
 if (watchdog.killedProcess()) {
  throw new ExecuteException(String.format("Watchdog killed Sencha Cmd process after %s ms.", MAX_EXECUTION_TIME), 0);
 }
}

代码示例来源:origin: openhab/openhab-core

PumpStreamHandler streamHandler = new PumpStreamHandler(stdout);
executor.setExitValue(1);
executor.setStreamHandler(streamHandler);
executor.setWatchdog(watchdog);

代码示例来源:origin: gov.nasa.jpl.imce/gov.nasa.jpl.magicdraw.projectUsageIntegrityChecker

executor.setExitValue(0);
executor.setWatchdog(watchdog);
executor.setWorkingDirectory(pugTemp);

代码示例来源:origin: com.hurence.logisland/logisland-agent

executor.setExitValue(0);
executor.setStreamHandler(psh);
try {

代码示例来源:origin: apache/bigtop

ExecuteWatchdog watchdog = new ExecuteWatchdog(60 * 10000);
Executor executor = new DefaultExecutor();
executor.setExitValue(1);
executor.setWatchdog(watchdog);
executor.setStreamHandler(streamHandler);

相关文章