OSProcessHandler handler = new OSProcessHandler( generalCommandLine.createProcess(), generalCommandLine.getPreparedCommandLine(Platform.current()) ); handler.addProcessListener( new ProcessAdapter() { @Override handler.startNotify(); handler.waitFor(); indicator.setText2("Refreshing"); } catch (ExecutionException e) {
private void showOutput(@NotNull OSProcessHandler originalHandler, @NotNull GoHistoryProcessListener historyProcessListener) { if (myShowOutputOnError) { BaseOSProcessHandler outputHandler = new KillableColoredProcessHandler(originalHandler.getProcess(), null); RunContentExecutor runContentExecutor = new RunContentExecutor(myProject, outputHandler) .withTitle(getPresentableName()) .withActivateToolWindow(myShowOutputOnError) .withFilter(new GoConsoleFilter(myProject, myModule, myWorkDirectory != null ? VfsUtilCore.pathToUrl(myWorkDirectory) : null)); Disposer.register(myProject, runContentExecutor); runContentExecutor.run(); historyProcessListener.apply(outputHandler); } if (myShowNotificationsOnError) { showNotification("Failed to run", NotificationType.ERROR); } }
myProcessHandler.addProcessListener(historyProcessListener); for (ProcessListener listener : myProcessListeners) { myProcessHandler.addProcessListener(listener); myProcessHandler.addProcessListener(processAdapter); myProcessHandler.startNotify(); ExecutionModes.SameThreadMode sameThreadMode = new ExecutionModes.SameThreadMode(getPresentableName()); ExecutionHelper.executeExternalProcess(myProject, myProcessHandler, sameThreadMode, commandLine);
OSProcessHandler processHandler = ScriptRunnerUtil.execute(myCommand[0], SymfonyInstallerCommandExecutor.this.baseDir.getPath(), null, Arrays.copyOfRange(myCommand, 1, myCommand.length)); processHandler.addProcessListener(new ProcessAdapter() { @Override public void onTextAvailable(ProcessEvent event, com.intellij.openapi.util.Key outputType) { processHandler.startNotify(); for (;;){ boolean finished = processHandler.waitFor(CHECKING_TIMEOUT_IN_MILLISECONDS); if (finished) { break; OSProcessManager.getInstance().killProcessTree(processHandler.getProcess()); break;
final OSProcessHandler handler = new OSProcessHandler(commandLine.createProcess(), commandLineString); handler.addProcessListener(new CapturingProcessAdapter() { @Override public void processTerminated(@NotNull final ProcessEvent event) { handler.startNotify(); } catch (final Exception ex) { showNotification("Formatting " + psiFile.getName() + " with DFormat failed",
final OSProcessHandler process = new OSProcessHandler(commandLine.createProcess(), commandLine.getCommandLineString()); process.startNotify(); process.waitFor(); backingFile.refresh(true, true);
@NotNull @Override protected ProcessHandler startProcess() throws ExecutionException { try { final GeneralCommandLine cmd = getDmdCommandLine(config); final OSProcessHandler handler = new OSProcessHandler(cmd.createProcess(), cmd.getCommandLineString()); handler.addProcessListener(this); return handler; } catch (final NoValidDlangSdkFound e) { throw new ExecutionException("No valid DMD SDK found!"); } catch (final NoSourcesException e) { throw new ExecutionException("No D Language source files found in directory: " + e.getSourcesRoot()); } catch (final ModuleNotFoundException e) { throw new ExecutionException("Run configuration has no module selected."); } catch (final ExecutionException e) { final String message = e.getMessage(); final boolean isEmpty = message.equals("Executable is not specified"); final boolean notCorrect = message.startsWith("Cannot run program"); if (isEmpty || notCorrect) { Notifications.Bus.notify( new Notification("DMD run configuration", "DMD settings", "DMD executable path is " + (isEmpty ? "empty" : "not specified correctly") + "<br/><a href='configure'>Configure</a>", NotificationType.ERROR), config.getProject()); } throw e; } }
@NotNull @Override protected ProcessHandler startProcess() throws ExecutionException { try { final GeneralCommandLine dubCommandLine = getExecutableCommandLine(config); return new OSProcessHandler(dubCommandLine.createProcess(), dubCommandLine.getCommandLineString()); } catch (final ExecutionException e) { final String message = e.getMessage(); final Project project = config.getProject(); final boolean isEmpty = message.equals("DUB executable is not specified"); final boolean notCorrect = message.startsWith("Cannot run program"); if (isEmpty || notCorrect) { Notifications.Bus.notify( new Notification("DUB run configuration", "DUB settings", "DUB executable is " + (isEmpty ? "not specified" : "not specified correctly") + "<br/><a href='configureDLanguageTools'>Configure</a> executable", NotificationType.ERROR, new DToolsNotificationListener(project)), project); } throw e; } }
myProcessHandler.addProcessListener(historyProcessListener); for (ProcessListener listener : myProcessListeners) { myProcessHandler.addProcessListener(listener); myProcessHandler.addProcessListener(processAdapter); myProcessHandler.startNotify(); ExecutionModes.SameThreadMode sameThreadMode = new ExecutionModes.SameThreadMode(getPresentableName()); ExecutionHelper.executeExternalProcess(myProject, myProcessHandler, sameThreadMode, commandLine);
@NotNull @Override public ProcessHandler startProcess() throws ExecutionException { try { final GeneralCommandLine appCommandLine = getExecutableCommandLine(config); return new OSProcessHandler(appCommandLine.createProcess(), appCommandLine.getCommandLineString()); } catch (final NoValidDlangSdkFound e) { throw new ExecutionException("No valid DMD SDK found!"); } catch (final ModuleNotFoundException e) { throw new ExecutionException("Run configuration has no module selected."); } catch (final ExecutionException e) { final String message = e.getMessage(); final boolean isEmpty = message.equals("Executable is not specified"); final boolean notCorrect = message.startsWith("Cannot run program"); if (isEmpty || notCorrect) { Notifications.Bus.notify( new Notification("D App run configuration", "D App settings", "D application executable path is " + (isEmpty ? "empty" : "not specified correctly") + "<br/><a href='configure'>Configure</a> output folder", NotificationType.ERROR), config.getProject()); } throw e; } }
@NotNull private String processFile(final PsiFile file, final String dubPath) { final GeneralCommandLine cmd = new GeneralCommandLine() .withWorkDirectory(file.getProject().getBasePath()) .withExePath(dubPath) .withEnvironment("DFLAGS", "-o-") .withParameters("build", "--combined", "-q"); try { final String dubCommand = cmd.getCommandLineString(); final DubProcessListener listener = new DubProcessListener(); final OSProcessHandler process = new OSProcessHandler(cmd.createProcess(), dubCommand); process.addProcessListener(listener); process.startNotify(); process.waitFor(); return listener.getOutput(); } catch (final ExecutionException e) { LOG.warn("There was a problem running 'dub build --combined -q'", e); } return ""; }
processHandler.addProcessListener(new ProcessAdapter() { @Override public void processTerminated(@NotNull ProcessEvent event) { processHandler.startNotify(); return callback;
private void showOutput(@NotNull OSProcessHandler originalHandler, @NotNull BallerinaHistoryProcessListener historyProcessListener) { if (myShowOutputOnError) { BaseOSProcessHandler outputHandler = new KillableColoredProcessHandler(originalHandler.getProcess(), null); RunContentExecutor runContentExecutor = new RunContentExecutor(myProject, outputHandler) .withTitle(getPresentableName()) .withActivateToolWindow(myShowOutputOnError) .withFilter(new BallerinaConsoleFilter(myProject, myModule, myWorkDirectory != null ? VfsUtilCore.pathToUrl(myWorkDirectory) : null)); Disposer.register(myProject, runContentExecutor); runContentExecutor.run(); historyProcessListener.apply(outputHandler); } if (myShowNotificationsOnError) { showNotification("Failed to run", NotificationType.ERROR); } }
final OSProcessHandler handler = new OSProcessHandler(commandLine); handler.addProcessListener(new ProcessAdapter() { @Override public void onTextAvailable(@NotNull final ProcessEvent event, handler.startNotify(); handler.waitFor(); final String configFile = configFileArray[0]; if (configFile == null) {
@Override public void shutdown() { super.shutdown(); ProcessHandler processHandler = getProcessHandler(); if (processHandler instanceof OSProcessHandler) { // todo[nik] remove later. This fix is necessary only for IDEA 8.x ((OSProcessHandler) processHandler).getProcess().destroy(); } } }
final DubProcessListener listener = new DubProcessListener(); final OSProcessHandler process = new OSProcessHandler(cmd.createProcess(), dubCommand); process.addProcessListener(listener); process.startNotify(); process.waitFor(); final Integer exitCode = process.getExitCode();
final OSProcessHandler process = new OSProcessHandler(cmd.createProcess(), cmd.getCommandLineString()); final DubInitListener listener = new DubInitListener(); process.addProcessListener(listener); process.startNotify(); process.waitFor();
final OSProcessHandler process = new OSProcessHandler(cmd.createProcess(), cmd.getCommandLineString()); process.addProcessListener(new ProcessAdapter() { @Override public void onTextAvailable(final ProcessEvent event, final Key outputType) { process.startNotify(); process.waitFor(); final Integer exitCode = process.getExitCode(); // 0 or 1 depending on whether DScanner found problems
final OSProcessHandler process = new OSProcessHandler(commandLine.createProcess(), commandLine.getCommandLineString()); process.addProcessListener(new ProcessAdapter() { @Override public void onTextAvailable(final ProcessEvent event, final Key outputType) { process.startNotify(); process.waitFor();