本文整理汇总了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;
}
}
示例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;
}
}
示例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;
}