Search in sources :

Example 1 with ProcessHandler

use of com.intellij.execution.process.ProcessHandler in project buck by facebook.

the class TestExecutionState method execute.

@Nullable
@Override
public ExecutionResult execute(Executor executor, @NotNull ProgramRunner runner) throws ExecutionException {
    final ProcessHandler processHandler = runBuildCommand(executor);
    final TestConsoleProperties properties = new BuckTestConsoleProperties(processHandler, mProject, mConfiguration, "Buck test", executor);
    final ConsoleView console = SMTestRunnerConnectionUtil.createAndAttachConsole("buck test", processHandler, properties);
    return new DefaultExecutionResult(console, processHandler, AnAction.EMPTY_ARRAY);
}
Also used : DefaultExecutionResult(com.intellij.execution.DefaultExecutionResult) ConsoleView(com.intellij.execution.ui.ConsoleView) OSProcessHandler(com.intellij.execution.process.OSProcessHandler) ProcessHandler(com.intellij.execution.process.ProcessHandler) TestConsoleProperties(com.intellij.execution.testframework.TestConsoleProperties) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with ProcessHandler

use of com.intellij.execution.process.ProcessHandler in project intellij-community by JetBrains.

the class CompileQrcAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    Project project = e.getData(CommonDataKeys.PROJECT);
    VirtualFile[] vFiles = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
    assert vFiles != null;
    Module module = e.getData(LangDataKeys.MODULE);
    String path = QtFileType.findQtTool(module, "pyrcc4");
    if (path == null) {
        path = QtFileType.findQtTool(module, "pyside-rcc");
    }
    if (path == null) {
        Messages.showErrorDialog(project, "Could not find pyrcc4 or pyside-rcc for selected Python interpreter", "Compile .qrc file");
        return;
    }
    CompileQrcDialog dialog = new CompileQrcDialog(project, vFiles);
    dialog.show();
    if (dialog.getExitCode() != DialogWrapper.OK_EXIT_CODE) {
        return;
    }
    GeneralCommandLine cmdLine = new GeneralCommandLine(path, "-o", dialog.getOutputPath());
    for (VirtualFile vFile : vFiles) {
        cmdLine.addParameter(vFile.getPath());
    }
    try {
        ProcessHandler process = new OSProcessHandler(cmdLine);
        ProcessTerminatedListener.attach(process);
        new RunContentExecutor(project, process).withTitle("Compile .qrc").run();
    } catch (ExecutionException ex) {
        Messages.showErrorDialog(project, "Error running " + path + ": " + ex.getMessage(), "Compile .qrc file");
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) OSProcessHandler(com.intellij.execution.process.OSProcessHandler) GeneralCommandLine(com.intellij.execution.configurations.GeneralCommandLine) OSProcessHandler(com.intellij.execution.process.OSProcessHandler) ProcessHandler(com.intellij.execution.process.ProcessHandler) RunContentExecutor(com.intellij.execution.RunContentExecutor) Module(com.intellij.openapi.module.Module) ExecutionException(com.intellij.execution.ExecutionException)

Example 3 with ProcessHandler

use of com.intellij.execution.process.ProcessHandler in project intellij-community by JetBrains.

the class RestCommandLineState method doCreateProcess.

protected ProcessHandler doCreateProcess(GeneralCommandLine commandLine) throws ExecutionException {
    final Runnable afterTask = getAfterTask();
    ProcessHandler processHandler = PythonProcessRunner.createProcess(commandLine, false);
    if (afterTask != null) {
        processHandler.addProcessListener(new ProcessAdapter() {

            public void processTerminated(ProcessEvent event) {
                SwingUtilities.invokeLater(afterTask);
            }
        });
    }
    return processHandler;
}
Also used : ProcessAdapter(com.intellij.execution.process.ProcessAdapter) ProcessEvent(com.intellij.execution.process.ProcessEvent) ProcessHandler(com.intellij.execution.process.ProcessHandler)

Example 4 with ProcessHandler

use of com.intellij.execution.process.ProcessHandler in project intellij-community by JetBrains.

the class SphinxBaseCommand method execute.

public void execute(@NotNull final Module module) {
    final Project project = module.getProject();
    try {
        if (!setWorkDir(module))
            return;
        final ProcessHandler process = createProcess(module);
        new RunContentExecutor(project, process).withFilter(new PythonTracebackFilter(project)).withTitle("reStructuredText").withRerun(() -> execute(module)).withAfterCompletion(getAfterTask(module)).run();
    } catch (ExecutionException e) {
        Messages.showErrorDialog(e.getMessage(), "ReStructuredText Error");
    }
}
Also used : Project(com.intellij.openapi.project.Project) ProcessHandler(com.intellij.execution.process.ProcessHandler) RunContentExecutor(com.intellij.execution.RunContentExecutor) ExecutionException(com.intellij.execution.ExecutionException) PythonTracebackFilter(com.jetbrains.python.run.PythonTracebackFilter)

Example 5 with ProcessHandler

use of com.intellij.execution.process.ProcessHandler in project intellij-community by JetBrains.

the class PyCCCommandLineState method doCreateProcess.

@Override
protected ProcessHandler doCreateProcess(GeneralCommandLine commandLine) throws ExecutionException {
    ProcessHandler handler = super.doCreateProcess(commandLine);
    handler.addProcessListener(new ProcessAdapter() {

        @Override
        public void processTerminated(ProcessEvent event) {
            ApplicationManager.getApplication().invokeLater(() -> EduUtils.deleteWindowDescriptions(myTask, myTaskDir));
        }
    });
    return handler;
}
Also used : ProcessAdapter(com.intellij.execution.process.ProcessAdapter) ProcessEvent(com.intellij.execution.process.ProcessEvent) ProcessHandler(com.intellij.execution.process.ProcessHandler)

Aggregations

ProcessHandler (com.intellij.execution.process.ProcessHandler)113 NotNull (org.jetbrains.annotations.NotNull)34 RunContentDescriptor (com.intellij.execution.ui.RunContentDescriptor)29 ExecutionException (com.intellij.execution.ExecutionException)18 Project (com.intellij.openapi.project.Project)18 ProcessEvent (com.intellij.execution.process.ProcessEvent)17 ProcessAdapter (com.intellij.execution.process.ProcessAdapter)16 ConsoleView (com.intellij.execution.ui.ConsoleView)16 DefaultExecutionResult (com.intellij.execution.DefaultExecutionResult)15 ExecutionEnvironment (com.intellij.execution.runners.ExecutionEnvironment)15 ProgramRunner (com.intellij.execution.runners.ProgramRunner)12 Nullable (org.jetbrains.annotations.Nullable)11 Executor (com.intellij.execution.Executor)9 RunProfile (com.intellij.execution.configurations.RunProfile)9 OSProcessHandler (com.intellij.execution.process.OSProcessHandler)9 GeneralCommandLine (com.intellij.execution.configurations.GeneralCommandLine)7 Disposable (com.intellij.openapi.Disposable)7 AndroidSessionInfo (com.android.tools.idea.run.AndroidSessionInfo)6 SMTRunnerConsoleView (com.intellij.execution.testframework.sm.runner.ui.SMTRunnerConsoleView)6 DefaultRunExecutor (com.intellij.execution.executors.DefaultRunExecutor)5