use of com.intellij.execution.ExecutionException in project intellij-community by JetBrains.
the class PlatformTestUtil method assertSuccessful.
public static void assertSuccessful(@NotNull GeneralCommandLine command) {
try {
ProcessOutput output = ExecUtil.execAndGetOutput(command.withRedirectErrorStream(true));
Assert.assertEquals(output.getStdout(), 0, output.getExitCode());
} catch (ExecutionException e) {
throw new RuntimeException(e);
}
}
use of com.intellij.execution.ExecutionException in project intellij-community by JetBrains.
the class ExecutionHandler method runBuild.
@Nullable
private static ProcessHandler runBuild(final ProgressIndicator progress, @NotNull final AntBuildMessageView errorView, @NotNull final AntBuildFileBase buildFile, @NotNull final AntBuildListener antBuildListener, @NotNull GeneralCommandLine commandLine) {
final Project project = buildFile.getProject();
final long startTime = System.currentTimeMillis();
LocalHistory.getInstance().putSystemLabel(project, AntBundle.message("ant.build.local.history.label", buildFile.getName()));
final AntProcessHandler handler;
try {
handler = AntProcessHandler.runCommandLine(commandLine);
} catch (final ExecutionException e) {
ApplicationManager.getApplication().invokeLater(() -> ExecutionErrorDialog.show(e, AntBundle.message("could.not.start.process.error.dialog.title"), project));
antBuildListener.buildFinished(AntBuildListener.FAILED_TO_RUN, 0);
return null;
}
processRunningAnt(progress, handler, errorView, buildFile, startTime, antBuildListener);
return handler;
}
use of com.intellij.execution.ExecutionException in project intellij-community by JetBrains.
the class DebuggerTestCase method createLocalSession.
protected DebuggerSession createLocalSession(final JavaParameters javaParameters) throws ExecutionException, InterruptedException {
createBreakpoints(javaParameters.getMainClass());
DebuggerSettings.getInstance().DEBUGGER_TRANSPORT = DebuggerSettings.SOCKET_TRANSPORT;
GenericDebuggerRunnerSettings debuggerRunnerSettings = new GenericDebuggerRunnerSettings();
debuggerRunnerSettings.LOCAL = true;
final RemoteConnection debugParameters = DebuggerManagerImpl.createDebugParameters(javaParameters, debuggerRunnerSettings, false);
ExecutionEnvironment environment = new ExecutionEnvironmentBuilder(myProject, DefaultDebugExecutor.getDebugExecutorInstance()).runnerSettings(debuggerRunnerSettings).runProfile(new MockConfiguration()).build();
final JavaCommandLineState javaCommandLineState = new JavaCommandLineState(environment) {
@Override
protected JavaParameters createJavaParameters() {
return javaParameters;
}
@Override
protected GeneralCommandLine createCommandLine() throws ExecutionException {
return getJavaParameters().toCommandLine();
}
};
ApplicationManager.getApplication().invokeAndWait(() -> {
try {
myDebuggerSession = DebuggerManagerEx.getInstanceEx(myProject).attachVirtualMachine(new DefaultDebugEnvironment(new ExecutionEnvironmentBuilder(myProject, DefaultDebugExecutor.getDebugExecutorInstance()).runProfile(new MockConfiguration()).build(), javaCommandLineState, debugParameters, false));
XDebuggerManager.getInstance(myProject).startSession(javaCommandLineState.getEnvironment(), new XDebugProcessStarter() {
@Override
@NotNull
public XDebugProcess start(@NotNull XDebugSession session) {
return JavaDebugProcess.create(session, myDebuggerSession);
}
});
} catch (ExecutionException e) {
LOG.error(e);
}
});
myDebugProcess = myDebuggerSession.getProcess();
myDebugProcess.addProcessListener(new ProcessAdapter() {
@Override
public void onTextAvailable(ProcessEvent event, Key outputType) {
print(event.getText(), outputType);
}
});
assertNotNull(myDebuggerSession);
assertNotNull(myDebugProcess);
return myDebuggerSession;
}
use of com.intellij.execution.ExecutionException in project intellij-community by JetBrains.
the class BaseExternalTool method show.
public void show(DiffRequest request) {
saveContents(request);
GeneralCommandLine commandLine = new GeneralCommandLine();
commandLine.setExePath(getToolPath());
try {
commandLine.addParameters(getParameters(request));
commandLine.createProcess();
} catch (Exception e) {
ExecutionErrorDialog.show(new ExecutionException(e.getMessage()), DiffBundle.message("cant.launch.diff.tool.error.message"), request.getProject());
}
}
use of com.intellij.execution.ExecutionException in project intellij-community by JetBrains.
the class JdkBundle method getJDKNameArchVersionAndUpdate.
private static Pair<Pair<String, Boolean>, Pair<Version, Integer>> getJDKNameArchVersionAndUpdate(File jvm, String homeSubPath) {
GeneralCommandLine commandLine = new GeneralCommandLine().withParentEnvironmentType(GeneralCommandLine.ParentEnvironmentType.NONE);
File jvmPath = new File(jvm, homeSubPath + File.separator + "jre" + File.separator + "bin" + File.separator + "java");
if (!jvmPath.exists()) {
jvmPath = new File(jvm, homeSubPath + File.separator + "bin" + File.separator + "java");
}
commandLine.setExePath(jvmPath.getAbsolutePath());
commandLine.addParameter("-version");
String displayVersion;
Boolean is64Bit = null;
Pair<Version, Integer> versionAndUpdate = null;
List<String> outputLines = null;
try {
outputLines = ExecUtil.execAndGetOutput(commandLine).getStderrLines();
} catch (ExecutionException e) {
// Checking for jdk 6 on mac
if (SystemInfo.isMac) {
commandLine.setExePath(new File(jvm, homeSubPath + File.separator + "bin" + File.separator + "java").getAbsolutePath());
try {
outputLines = ExecUtil.execAndGetOutput(commandLine).getStderrLines();
} catch (ExecutionException e1) {
LOG.debug(e);
}
}
LOG.debug(e);
}
if (outputLines != null && outputLines.size() >= 1) {
String versionLine = outputLines.get(0);
versionAndUpdate = VersionUtil.parseVersionAndUpdate(versionLine, VERSION_UPDATE_PATTERNS);
displayVersion = versionLine.replaceFirst("\".*\"", "");
if (outputLines.size() >= 3) {
is64Bit = is64BitJVM(outputLines.get(2));
}
} else {
displayVersion = jvm.getName();
}
return Pair.create(Pair.create(displayVersion, is64Bit), versionAndUpdate);
}
Aggregations