use of com.microsoft.intellij.RunProcessHandler in project azure-tools-for-java by Microsoft.
the class CreateWebAppAction method deploy.
@AzureOperation(name = "webapp.deploy_artifact", params = { "webapp.name()" }, type = AzureOperation.Type.ACTION)
private void deploy(final IWebApp webapp, final Path application, final Project project) {
final AzureString title = title("webapp.deploy_artifact", webapp.name());
final AzureTask<Void> task = new AzureTask<>(null, title, false, () -> {
ProgressManager.getInstance().getProgressIndicator().setIndeterminate(true);
final RunProcessHandler processHandler = new RunProcessHandler();
processHandler.addDefaultListener();
final ConsoleView consoleView = TextConsoleBuilderFactory.getInstance().createBuilder(project).getConsole();
processHandler.startNotify();
consoleView.attachToProcess(processHandler);
AzureWebAppMvpModel.getInstance().deployArtifactsToWebApp(webapp, application.toFile(), true, processHandler);
});
AzureTaskManager.getInstance().runInModalAsObservable(task).single().subscribe((none) -> {
this.notifyDeploymentSuccess(webapp);
});
// let root exception handler to show the error.
}
use of com.microsoft.intellij.RunProcessHandler in project azure-tools-for-java by Microsoft.
the class AzureRunProfileState method execute.
@Nullable
@Override
public ExecutionResult execute(Executor executor, @NotNull ProgramRunner programRunner) throws ExecutionException {
final RunProcessHandler processHandler = new RunProcessHandler();
processHandler.addDefaultListener();
ConsoleView consoleView = TextConsoleBuilderFactory.getInstance().createBuilder(this.project).getConsole();
processHandler.startNotify();
consoleView.attachToProcess(processHandler);
final Operation operation = createOperation();
final Disposable subscribe = Mono.fromCallable(() -> {
try {
operation.start();
return this.executeSteps(processHandler, operation);
} finally {
// Once the operation done, whether success or not, `setText` should not throw new exception
processHandler.setProcessTerminatedHandler(RunProcessHandler.DO_NOTHING);
}
}).subscribeOn(Schedulers.boundedElastic()).subscribe((res) -> {
this.sendTelemetry(operation, null);
this.onSuccess(res, processHandler);
}, (err) -> {
err.printStackTrace();
this.sendTelemetry(operation, err);
this.onFail(err, processHandler);
});
processHandler.addProcessListener(new ProcessAdapter() {
@Override
public void processTerminated(@NotNull ProcessEvent event) {
subscribe.dispose();
}
});
return new DefaultExecutionResult(consoleView, processHandler);
}
use of com.microsoft.intellij.RunProcessHandler in project azure-tools-for-java by Microsoft.
the class SpringCloudDeploymentConfigurationState method execute.
@Override
@Nullable
public ExecutionResult execute(Executor executor, @NotNull ProgramRunner<?> runner) throws ExecutionException {
final RunProcessHandler processHandler = new RunProcessHandler();
processHandler.addDefaultListener();
processHandler.startNotify();
processHandler.setProcessTerminatedHandler(RunProcessHandler.DO_NOTHING);
final ConsoleMessager messager = new ConsoleMessager(processHandler);
final ConsoleView consoleView = TextConsoleBuilderFactory.getInstance().createBuilder(this.project).getConsole();
consoleView.attachToProcess(processHandler);
final Disposable subscribe = Mono.fromCallable(() -> this.execute(messager)).doOnTerminate(processHandler::notifyComplete).subscribeOn(Schedulers.boundedElastic()).subscribe((res) -> messager.success("Deploy succeed!"), messager::error);
processHandler.addProcessListener(new ProcessAdapter() {
@Override
public void processTerminated(@NotNull ProcessEvent event) {
subscribe.dispose();
}
});
return new DefaultExecutionResult(consoleView, processHandler);
}
Aggregations