use of org.eclipse.linuxtools.docker.core.DockerCommandNotFoundException in project linuxtools by eclipse.
the class DockerComposeUpJob method run.
@Override
protected IStatus run(final IProgressMonitor monitor) {
final String dockerComposeInstallDir = Activator.getDefault().getPreferenceStore().getString(PreferenceConstants.DOCKER_COMPOSE_INSTALLATION_DIRECTORY);
final Thread commandThread = new Thread(() -> {
// open console view
ConsolePlugin.getDefault().getConsoleManager().showConsoleView(dockerComposeConsole);
try {
// run the 'docker-compose up' command
final Process dockerComposeSystemProcess = DockerCompose.getInstance().up(this.connection, dockerComposeInstallDir, this.workingDir);
final ILaunch launch = new Launch(launchConfiguration, ILaunchManager.RUN_MODE, null);
final IProcess dockerComposeProcess = DebugPlugin.newProcess(launch, dockerComposeSystemProcess, // $NON-NLS-1$
"docker-compose up");
dockerComposeConsole.setDockerComposeProcess(// $NON-NLS-1$
dockerComposeProcess);
final int exitCode = dockerComposeSystemProcess.waitFor();
if (exitCode != 0) {
Display.getDefault().asyncExec(() -> MessageDialog.openError(Display.getDefault().getActiveShell(), JobMessages.getString(// $NON-NLS-1$
"DockerCompose.dialog.title"), JobMessages.getString(// $NON-NLS-1$
"DockerComposeUp.start.error")));
}
} catch (DockerCommandNotFoundException e) {
// just display the error to the user, there's no need to report
// an error in the log and in AERI for that.
Display.getDefault().asyncExec(() -> MessageDialog.openError(Display.getCurrent().getActiveShell(), JobMessages.getString(// $NON-NLS-1$
"DockerCompose.dialog.title"), e.getMessage()));
} catch (DockerException | InterruptedException e) {
Display.getDefault().asyncExec(() -> MessageDialog.openError(Display.getCurrent().getActiveShell(), JobMessages.getString(// $NON-NLS-1$
"DockerCompose.dialog.title"), e.getMessage()));
Activator.log(e);
}
});
commandThread.start();
return Status.OK_STATUS;
}
Aggregations