Search in sources :

Example 96 with ProcessHandler

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

the class ProcessHandlerConsolePrinterTest method testSetProcessHandlerWhenConstructedWithOne.

public void testSetProcessHandlerWhenConstructedWithOne() {
    ProcessHandlerConsolePrinter printer = new ProcessHandlerConsolePrinter(mock(ProcessHandler.class));
    printer.stdout("stdout1");
    ProcessHandler handler = mock(ProcessHandler.class);
    printer.setProcessHandler(handler);
    printer.stdout("stdout2");
    // New messages are sent to the last-set process handler.
    verify(handler).notifyTextAvailable("stdout2\n", STDOUT);
    // Previous messages were not sent to the last-set process handler.
    verifyNoMoreInteractions(handler);
}
Also used : ProcessHandler(com.intellij.execution.process.ProcessHandler)

Example 97 with ProcessHandler

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

the class FlexUnitTestRunner method execute.

@Override
public void execute(@NotNull final ExecutionEnvironment env, @Nullable final Callback callback) throws ExecutionException {
    final Project project = env.getProject();
    final RunProfileState state = env.getState();
    if (state == null) {
        return;
    }
    Runnable startRunnable = () -> {
        try {
            if (project.isDisposed())
                return;
            final RunContentDescriptor descriptor = doExecute(state, env);
            if (callback != null)
                callback.processStarted(descriptor);
            if (descriptor != null) {
                ExecutionManager.getInstance(project).getContentManager().showRunContent(env.getExecutor(), descriptor);
                final ProcessHandler processHandler = descriptor.getProcessHandler();
                if (processHandler != null)
                    processHandler.startNotify();
            }
        } catch (ExecutionException e) {
            ExecutionUtil.handleExecutionError(env, e);
        }
    };
    ExecutionManager.getInstance(project).compileAndRun(startRunnable, env, state, null);
}
Also used : Project(com.intellij.openapi.project.Project) RunContentDescriptor(com.intellij.execution.ui.RunContentDescriptor) RunProfileState(com.intellij.execution.configurations.RunProfileState) ProcessHandler(com.intellij.execution.process.ProcessHandler) ExecutionException(com.intellij.execution.ExecutionException)

Example 98 with ProcessHandler

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

the class ProcessHandlerConsolePrinterTest method testSetProcessHandlerRepeatedly.

public void testSetProcessHandlerRepeatedly() {
    ProcessHandlerConsolePrinter printer = new ProcessHandlerConsolePrinter(null);
    printer.stdout("stdout1");
    printer.stderr("stderr1");
    printer.setProcessHandler(mock(ProcessHandler.class));
    printer.stdout("stdout2");
    ProcessHandler handler = mock(ProcessHandler.class);
    printer.setProcessHandler(handler);
    printer.stdout("stdout3");
    // New messages are sent to the last-set process handler.
    verify(handler).notifyTextAvailable("stdout3\n", STDOUT);
    // None of the earlier messages are sent to the last-set process handler.
    verifyNoMoreInteractions(handler);
}
Also used : ProcessHandler(com.intellij.execution.process.ProcessHandler)

Example 99 with ProcessHandler

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

the class KarmaRunProfileState method executeWithServer.

@NotNull
public ExecutionResult executeWithServer(@NotNull Executor executor, @NotNull KarmaServer server) throws ExecutionException {
    server.getWatcher().flush();
    KarmaExecutionSession session = new KarmaExecutionSession(myProject, myRunConfiguration, executor, server, myRunSettings, myExecutionType);
    SMTRunnerConsoleView smtRunnerConsoleView = session.getSmtConsoleView();
    ProcessHandler processHandler = session.getProcessHandler();
    // TODO make smtRunnerConsoleView instance of LanguageConsoleView to make it more usage for debugging
    DefaultExecutionResult executionResult = new DefaultExecutionResult(smtRunnerConsoleView, processHandler);
    executionResult.setRestartActions(new ToggleAutoTestAction());
    return executionResult;
}
Also used : SMTRunnerConsoleView(com.intellij.execution.testframework.sm.runner.ui.SMTRunnerConsoleView) ProcessHandler(com.intellij.execution.process.ProcessHandler) ToggleAutoTestAction(com.intellij.execution.testframework.autotest.ToggleAutoTestAction) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ProcessHandler (com.intellij.execution.process.ProcessHandler)99 NotNull (org.jetbrains.annotations.NotNull)30 RunContentDescriptor (com.intellij.execution.ui.RunContentDescriptor)24 ExecutionException (com.intellij.execution.ExecutionException)17 Project (com.intellij.openapi.project.Project)17 ConsoleView (com.intellij.execution.ui.ConsoleView)15 DefaultExecutionResult (com.intellij.execution.DefaultExecutionResult)14 ProcessEvent (com.intellij.execution.process.ProcessEvent)14 ExecutionEnvironment (com.intellij.execution.runners.ExecutionEnvironment)14 ProcessAdapter (com.intellij.execution.process.ProcessAdapter)13 ProgramRunner (com.intellij.execution.runners.ProgramRunner)12 Nullable (org.jetbrains.annotations.Nullable)10 Executor (com.intellij.execution.Executor)9 GeneralCommandLine (com.intellij.execution.configurations.GeneralCommandLine)7 Disposable (com.intellij.openapi.Disposable)7 RunProfile (com.intellij.execution.configurations.RunProfile)6 OSProcessHandler (com.intellij.execution.process.OSProcessHandler)6 File (java.io.File)6 DefaultRunExecutor (com.intellij.execution.executors.DefaultRunExecutor)5 ToggleAutoTestAction (com.intellij.execution.testframework.autotest.ToggleAutoTestAction)5