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


Java OSProcessHandler.isProcessTerminated方法代码示例

本文整理汇总了Java中com.intellij.execution.process.OSProcessHandler.isProcessTerminated方法的典型用法代码示例。如果您正苦于以下问题:Java OSProcessHandler.isProcessTerminated方法的具体用法?Java OSProcessHandler.isProcessTerminated怎么用?Java OSProcessHandler.isProcessTerminated使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.execution.process.OSProcessHandler的用法示例。


在下文中一共展示了OSProcessHandler.isProcessTerminated方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shutdownProcess

import com.intellij.execution.process.OSProcessHandler; //导入方法依赖的package包/类
private void shutdownProcess() {
  final OSProcessHandler processHandler = myProcessHandler;
  if (processHandler != null) {
    if (!processHandler.isProcessTerminated()) {
      boolean forceQuite = true;
      try {
        writeLine(EXIT_COMMAND);
        forceQuite = !processHandler.waitFor(500);
        if (forceQuite) {
          LOG.warn("File watcher is still alive. Doing a force quit.");
        }
      }
      catch (IOException ignore) { }
      if (forceQuite) {
        processHandler.destroyProcess();
      }
    }

    myProcessHandler = null;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:NativeFileWatcherImpl.java

示例2: shutdownProcess

import com.intellij.execution.process.OSProcessHandler; //导入方法依赖的package包/类
private void shutdownProcess() {
  final OSProcessHandler processHandler = myProcessHandler;
  if (processHandler != null) {
    if (!processHandler.isProcessTerminated()) {
      boolean killProcess = true;
      try {
        writeLine(EXIT_COMMAND);
        killProcess = !processHandler.waitFor(500);
        if (killProcess) {
          LOG.warn("File watcher is still alive. Doing a force quit.");
        }
      }
      catch (IOException ignore) {
      }
      if (killProcess) {
        processHandler.destroyProcess();
      }
    }

    myProcessHandler = null;
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:NativeFileWatcherImpl.java

示例3: executeCommand

import com.intellij.execution.process.OSProcessHandler; //导入方法依赖的package包/类
@NotNull
public static ExecutionStatus executeCommand(@NotNull GeneralCommandLine commandLine,
                                             @Nullable final OutputProcessor processor,
                                             @Nullable WaitingStrategies.Strategy strategy) throws ExecutionException {
  LOG.info(commandLine.getCommandLineString());
  OSProcessHandler handler = new OSProcessHandler(commandLine.createProcess(), "");

  final ProcessAdapter listener = new ProcessAdapter() {
    @Override
    public void onTextAvailable(final ProcessEvent event, final Key outputType) {
      if (processor != null) {
        final String message = event.getText();
        processor.onTextAvailable(message);
      }
    }
  };

  if (!(strategy instanceof WaitingStrategies.DoNotWait)) {
    handler.addProcessListener(listener);
  }

  handler.startNotify();
  try {
    if (!(strategy instanceof WaitingStrategies.WaitForever)) {
      if (strategy instanceof WaitingStrategies.WaitForTime) {
        handler.waitFor(((WaitingStrategies.WaitForTime)strategy).getTimeMs());
      }
    }
    else {
      handler.waitFor();
    }
  }
  catch (ProcessCanceledException e) {
    return ExecutionStatus.ERROR;
  }

  if (!handler.isProcessTerminated()) {
    return ExecutionStatus.TIMEOUT;
  }

  if (!(strategy instanceof WaitingStrategies.DoNotWait)) {
    handler.removeProcessListener(listener);
  }
  int exitCode = handler.getProcess().exitValue();
  return exitCode == 0 ? ExecutionStatus.SUCCESS : ExecutionStatus.ERROR;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:47,代码来源:AndroidUtils.java


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