Examples of OSProcessHandler


Examples of com.intellij.execution.process.OSProcessHandler

    commandLine.setExePath(ErlangConsoleUtil.getErlPath(project, module));
    String consoleArgs = myConfig.getConsoleArgs();
    commandLine.addParameters(StringUtil.split(consoleArgs, " "));
    commandLine.addParameters(ErlangConsoleUtil.getCodePath(project, module, false));
    commandLine.setWorkDirectory(ErlangConsoleUtil.getWorkingDirPath(project, myConfig.getWorkingDirPath()));
    OSProcessHandler handler = new OSProcessHandler(commandLine.createProcess(), commandLine.getCommandLineString());
    ProcessTerminatedListener.attach(handler);
    return handler;
  }
View Full Code Here

Examples of com.intellij.execution.process.OSProcessHandler

      commandLine.addParameter(emacsCommand);

      ApplicationManager.getApplication().saveAll();

      final String commandLineString = commandLine.getCommandLineString();
      OSProcessHandler handler = new OSProcessHandler(commandLine.createProcess(), commandLineString);
      handler.addProcessListener(new ProcessAdapter() {
        @Override
        public void processTerminated(ProcessEvent event) {
          ApplicationManager.getApplication().invokeLater(new Runnable() {
            @Override
            public void run() {
              try {
                final String emacsText = FileUtilRt.loadFile(tmpFile, true);
                if (StringUtil.isEmptyOrSpaces(emacsText)) {
                  Notifications.Bus.notify(new Notification(groupId, NOTIFICATION_TITLE,
                    "Emacs returned an empty file",
                    NotificationType.WARNING), project);
                  LOG.warn("Emacs returned an empty file:\n" + commandLineString);
                  return;
                }
                final Document document = PsiDocumentManager.getInstance(project).getDocument(psiFile);
                if (document == null) return;
                CommandProcessor.getInstance().executeCommand(project, new Runnable() {
                  @Override
                  public void run() {
                    ApplicationManager.getApplication().runWriteAction(new Runnable() {
                      @Override
                      public void run() {
                        document.setText(emacsText);
                      }
                    });
                  }
                }, NOTIFICATION_TITLE, "", document);

                Notifications.Bus.notify(new Notification(groupId, NOTIFICATION_TITLE,
                  psiFile.getName() + " formatted with Emacs",
                  NotificationType.INFORMATION), project);

              } catch (Exception ex) {
                Notifications.Bus.notify(new Notification(groupId,
                  psiFile.getName() + " formatting with Emacs failed", ExceptionUtil.getUserStackTrace(ex, LOG),
                  NotificationType.ERROR), project);
                LOG.error(ex);
              }
            }
          });
        }
      });
      handler.startNotify();
    } catch (Exception ex) {
      Notifications.Bus.notify(new Notification(groupId,
        psiFile.getName() + " formatting with Emacs failed", ExceptionUtil.getUserStackTrace(ex, LOG),
        NotificationType.ERROR), project);
      LOG.error(ex);
View Full Code Here

Examples of com.intellij.execution.process.OSProcessHandler

    commandLine.addParameters("-run", "debugnode", "main", myDebuggerNode.getName(), myDebuggerNode.getMessageBoxName());
    runningState.setErlangFlags(commandLine);
    runningState.setNoShellMode(commandLine);
    runningState.setStopErlang(commandLine);
    Process process = commandLine.createProcess();
    myErlangProcessHandler = new OSProcessHandler(process, commandLine.getCommandLineString());
    getSession().getConsoleView().attachToProcess(myErlangProcessHandler);
    myErlangProcessHandler.startNotify();
    if (runningState instanceof ErlangRemoteDebugRunningState) {
      ErlangRemoteDebugRunConfiguration runConfiguration = (ErlangRemoteDebugRunConfiguration) getRunConfiguration();
      if (StringUtil.isEmptyOrSpaces(runConfiguration.getErlangNode())) {
View Full Code Here

Examples of com.intellij.execution.process.OSProcessHandler

  @NotNull
  @Override
  protected ProcessHandler startProcess() throws ExecutionException {
    GeneralCommandLine commandLine = getCommand();
    return new OSProcessHandler(commandLine.createProcess(), commandLine.getCommandLineString());
  }
View Full Code Here

Examples of com.intellij.execution.process.OSProcessHandler

                try {
                  if (project.isDisposed()) {
                    return;
                  }
                  myBuildsInProgress.put(projectPath, future);
                  final OSProcessHandler processHandler = launchBuildProcess(project, sessionId, scope);
                  final StringBuilder stdErrOutput = new StringBuilder();
                  processHandler.addProcessListener(new ProcessAdapter() {
                    @Override
                    public void onTextAvailable(ProcessEvent event, Key outputType) {
                      // re-translate builder's output to idea.log
                      final String text = event.getText();
                      if (!StringUtil.isEmptyOrSpaces(text)) {
                        LOG.info("RUST_BUILDER_PROCESS [" + outputType.toString() + "]: " + text.trim());
                        if (ProcessOutputTypes.STDERR.equals(outputType)) {
                          stdErrOutput.append(text);
                        }
                      }
                    }
                  });
                  processHandler.startNotify();
                  final boolean terminated = processHandler.waitFor();
                  if (terminated) {
                    final int exitValue = processHandler.getProcess().exitValue();
                    if (exitValue != 0) {
                      final String msg;
                      if (stdErrOutput.length() > 0) {
                        msg = stdErrOutput.toString();
                      }
View Full Code Here

Examples of com.intellij.execution.process.OSProcessHandler

    cmdLine.addParameter(rustConfiguration.mainFile);
    cmdLine.addParameters("-o", outputPathUrl.concat("/").concat(rustConfiguration.getName()));

    final Process process = cmdLine.createProcess();

    return new OSProcessHandler(process, null, mySystemCharset) {
      @Override
      protected boolean shouldDestroyProcessRecursively() {
        return true;
      }
    };
View Full Code Here

Examples of com.intellij.execution.process.OSProcessHandler

        return commandLine.createProcess();
    }

    @Override
    protected OSProcessHandler createProcessHandler(Process process) {
        return new OSProcessHandler(process, null);
    }
View Full Code Here

Examples of com.intellij.execution.process.OSProcessHandler

    @NotNull
    @Override
    protected ProcessHandler startProcess() throws ExecutionException {
        GeneralCommandLine commandLine = generateCommandLine();
        final OSProcessHandler processHandler = new ColoredProcessHandler(commandLine);
        ProcessTerminatedListener.attach(processHandler);
        return processHandler;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.