use of com.intellij.execution.ExecutionException in project android by JetBrains.
the class AndroidRunDdmsAction method doLaunchDdms.
private static void doLaunchDdms(GeneralCommandLine commandLine, final Project project, final boolean adbServiceWasEnabled) {
try {
ourProcessHandler = new OSProcessHandler(commandLine);
ourProcessHandler.startNotify();
ourProcessHandler.waitFor();
} catch (ExecutionException e) {
LOG.info(e);
} finally {
ourProcessHandler = null;
if (adbServiceWasEnabled) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
if (project.isDisposed()) {
return;
}
AndroidEnableAdbServiceAction.setAdbServiceEnabled(project, true);
// trigger creation of new bridge
File adb = AndroidSdkUtils.getAdb(project);
if (adb != null) {
AdbService.getInstance().getDebugBridge(adb);
}
}
});
}
}
}
use of com.intellij.execution.ExecutionException in project intellij-elixir by KronicDeth.
the class MixBuilder method runMix.
private static void runMix(@NotNull String elixirPath, @NotNull String mixPath, @Nullable String contentRootPath, boolean addDebugInfo, @NotNull CompileContext context) throws ProjectBuildException {
GeneralCommandLine commandLine = new GeneralCommandLine();
commandLine.withWorkDirectory(contentRootPath);
commandLine.setExePath(elixirPath);
commandLine.addParameter(mixPath);
commandLine.addParameter("compile");
if (!addDebugInfo) {
commandLine.addParameter("--no-debug-info");
}
Process process;
try {
process = commandLine.createProcess();
} catch (ExecutionException e) {
throw new ProjectBuildException("Failed to run mix.", e);
}
BaseOSProcessHandler handler = new BaseOSProcessHandler(process, commandLine.getCommandLineString(), Charset.defaultCharset());
ProcessAdapter adapter = new ElixirCompilerProcessAdapter(context, NAME, commandLine.getWorkDirectory().getPath());
handler.addProcessListener(adapter);
handler.startNotify();
handler.waitFor();
}
use of com.intellij.execution.ExecutionException in project intellij-plugins by JetBrains.
the class KarmaExecutionSession method createCommandLine.
@NotNull
private GeneralCommandLine createCommandLine(@NotNull NodeJsLocalInterpreter interpreter, int serverPort, @Nullable KarmaConfig config, @NotNull File clientAppFile) throws ExecutionException {
GeneralCommandLine commandLine = new GeneralCommandLine();
File configFile = new File(myRunSettings.getConfigPath());
// looks like it should work with any working directory
commandLine.setWorkDirectory(configFile.getParentFile());
commandLine.setCharset(CharsetToolkit.UTF8_CHARSET);
commandLine.setExePath(interpreter.getInterpreterSystemDependentPath());
//NodeCommandLineUtil.addNodeOptionsForDebugging(commandLine, Collections.emptyList(), 5858, false, interpreter, true);
commandLine.addParameter(clientAppFile.getAbsolutePath());
commandLine.addParameter("--karmaPackageDir=" + myKarmaServer.getServerSettings().getKarmaPackage().getSystemDependentPath());
commandLine.addParameter("--serverPort=" + serverPort);
if (config != null) {
commandLine.addParameter("--urlRoot=" + config.getUrlRoot());
}
if (isDebug()) {
commandLine.addParameter("--debug=true");
}
if (myRunSettings.getScopeKind() == KarmaScopeKind.TEST_FILE) {
List<String> topNames = findTopLevelSuiteNames(myProject, myRunSettings.getTestFileSystemIndependentPath());
if (topNames.size() > 1) {
throw new ExecutionException("Cannot run test file with several top level suites");
}
topNames = ContainerUtil.map(topNames, s -> s + " ");
commandLine.addParameter("--testName=" + StringUtil.join(topNames, "|"));
} else if (myRunSettings.getScopeKind() == KarmaScopeKind.SUITE || myRunSettings.getScopeKind() == KarmaScopeKind.TEST) {
commandLine.addParameter("--testName=" + StringUtil.join(myRunSettings.getTestNames(), " "));
}
return commandLine;
}
use of com.intellij.execution.ExecutionException in project intellij-plugins by JetBrains.
the class KarmaCoverageProgramRunner method listenForCoverageFile.
private static void listenForCoverageFile(@NotNull ExecutionEnvironment env, @NotNull KarmaServer server) throws ExecutionException {
KarmaRunConfiguration runConfiguration = (KarmaRunConfiguration) env.getRunProfile();
CoverageEnabledConfiguration coverageEnabledConfiguration = CoverageEnabledConfiguration.getOrCreate(runConfiguration);
CoverageHelper.resetCoverageSuit(runConfiguration);
String coverageFilePath = coverageEnabledConfiguration.getCoverageFilePath();
if (coverageFilePath != null) {
KarmaCoveragePeer coveragePeer = server.getCoveragePeer();
Objects.requireNonNull(coveragePeer);
coveragePeer.startCoverageSession(new KarmaCoverageSession() {
@Override
public void onCoverageSessionFinished(@Nullable File lcovFile) {
LOG.info("Processing karma coverage file: " + lcovFile);
UIUtil.invokeLaterIfNeeded(() -> {
Project project = env.getProject();
if (project.isDisposed())
return;
if (lcovFile != null) {
processLcovInfoFile(lcovFile, coverageFilePath, env, server, runConfiguration);
} else {
int response = Messages.showYesNoDialog(project, "Cannot find karma test coverage report - lcov.info", "Missing Karma Coverage Report", "Select lcov.info", "Cancel", Messages.getWarningIcon());
if (response == Messages.YES) {
FileChooser.chooseFile(FileChooserDescriptorFactory.createSingleFileDescriptor(), project, null, null, file -> {
File selected = file != null ? VfsUtilCore.virtualToIoFile(file) : null;
if (selected != null) {
processLcovInfoFile(selected, coverageFilePath, env, server, runConfiguration);
}
});
}
}
});
}
});
}
}
use of com.intellij.execution.ExecutionException in project buck by facebook.
the class TestExecutionState method attachDebugger.
private void attachDebugger(String title, String port) {
final RemoteConnection remoteConnection = new RemoteConnection(/* useSockets */
true, "localhost", port, /* serverMode */
false);
final RemoteStateState state = new RemoteStateState(mProject, remoteConnection);
final String name = title + " debugger (" + port + ")";
final ConfigurationFactory cfgFactory = ConfigurationTypeUtil.findConfigurationType("Remote").getConfigurationFactories()[0];
RunnerAndConfigurationSettings runSettings = RunManager.getInstance(mProject).createRunConfiguration(name, cfgFactory);
final Executor debugExecutor = DefaultDebugExecutor.getDebugExecutorInstance();
final ExecutionEnvironment env = new ExecutionEnvironmentBuilder(mProject, debugExecutor).runProfile(runSettings.getConfiguration()).build();
final int pollTimeout = 3000;
final DebugEnvironment environment = new DefaultDebugEnvironment(env, state, remoteConnection, pollTimeout);
ApplicationManager.getApplication().invokeLater(() -> {
try {
final DebuggerSession debuggerSession = DebuggerManagerEx.getInstanceEx(mProject).attachVirtualMachine(environment);
if (debuggerSession == null) {
return;
}
XDebuggerManager.getInstance(mProject).startSessionAndShowTab(name, null, new XDebugProcessStarter() {
@Override
@NotNull
public XDebugProcess start(@NotNull XDebugSession session) {
return JavaDebugProcess.create(session, debuggerSession);
}
});
} catch (ExecutionException e) {
LOG.error("failed to attach to debugger on port " + port + " with polling timeout " + pollTimeout);
}
});
}
Aggregations