use of com.intellij.execution.ExecutionException in project intellij-community by JetBrains.
the class GroovyConsole method createProcessHandler.
private static ProcessHandler createProcessHandler(Module module) {
try {
final JavaParameters javaParameters = createJavaParameters(module);
final GeneralCommandLine commandLine = javaParameters.toCommandLine();
return new OSProcessHandler(commandLine) {
@Override
public boolean isSilentlyDestroyOnClose() {
return true;
}
};
} catch (ExecutionException e) {
LOG.warn(e);
return null;
}
}
use of com.intellij.execution.ExecutionException in project intellij-community by JetBrains.
the class CommandExecutor method start.
public void start() throws SvnBindException {
synchronized (myLock) {
checkNotStarted();
try {
beforeCreateProcess();
myProcess = createProcess();
if (LOG.isDebugEnabled()) {
LOG.debug(myCommandLine.toString());
}
myHandler = createProcessHandler();
myProcessWriter = new OutputStreamWriter(myHandler.getProcessInput());
startHandlingStreams();
} catch (ExecutionException e) {
// TODO: currently startFailed() is not used for some real logic in svn4idea plugin
listeners().startFailed(e);
throw new SvnBindException(e);
}
}
}
use of com.intellij.execution.ExecutionException in project intellij-community by JetBrains.
the class PydevConsoleRunnerImpl method connectToDebugger.
private XDebugSession connectToDebugger() throws ExecutionException {
final ServerSocket serverSocket = PythonCommandLineState.createServerSocket();
final XDebugSession session = XDebuggerManager.getInstance(myProject).startSessionAndShowTab("Python Console Debugger", PythonIcons.Python.Python, null, true, new XDebugProcessStarter() {
@NotNull
public XDebugProcess start(@NotNull final XDebugSession session) {
PythonDebugLanguageConsoleView debugConsoleView = new PythonDebugLanguageConsoleView(myProject, mySdk);
PyConsoleDebugProcessHandler consoleDebugProcessHandler = new PyConsoleDebugProcessHandler(myProcessHandler);
PyConsoleDebugProcess consoleDebugProcess = new PyConsoleDebugProcess(session, serverSocket, debugConsoleView, consoleDebugProcessHandler);
PythonDebugConsoleCommunication communication = PyDebugRunner.initDebugConsoleView(myProject, consoleDebugProcess, debugConsoleView, consoleDebugProcessHandler, session);
communication.addCommunicationListener(new ConsoleCommunicationListener() {
@Override
public void commandExecuted(boolean more) {
session.rebuildViews();
}
@Override
public void inputRequested() {
}
});
myPydevConsoleCommunication.setDebugCommunication(communication);
debugConsoleView.attachToProcess(consoleDebugProcessHandler);
consoleDebugProcess.waitForNextConnection();
try {
consoleDebugProcess.connect(myPydevConsoleCommunication);
} catch (Exception e) {
//TODO
LOG.error(e);
}
myProcessHandler.notifyTextAvailable("\nDebugger connected.\n", ProcessOutputTypes.STDERR);
return consoleDebugProcess;
}
});
return session;
}
use of com.intellij.execution.ExecutionException in project intellij-community by JetBrains.
the class PydevConsoleRunnerImpl method createRemoteConsoleProcess.
private RemoteProcess createRemoteConsoleProcess(PythonRemoteInterpreterManager manager, String[] command, Map<String, String> env, File workDirectory) throws ExecutionException {
PyRemoteSdkAdditionalDataBase data = (PyRemoteSdkAdditionalDataBase) mySdk.getSdkAdditionalData();
assert data != null;
GeneralCommandLine commandLine = new GeneralCommandLine();
commandLine.setWorkDirectory(workDirectory);
commandLine.withParameters(command);
commandLine.getEnvironment().putAll(env);
commandLine.getParametersList().set(0, PythonRemoteInterpreterManager.toSystemDependent(new File(data.getHelpersPath(), getRunnerFileFromHelpers()).getPath(), PySourcePosition.isWindowsPath(data.getInterpreterPath())));
commandLine.getParametersList().set(1, "0");
commandLine.getParametersList().set(2, "0");
try {
PyRemotePathMapper pathMapper = PydevConsoleRunner.getPathMapper(myProject, mySdk, myConsoleSettings);
assert pathMapper != null;
commandLine.putUserData(PyRemoteProcessStarter.OPEN_FOR_INCOMING_CONNECTION, true);
// we do not have an option to setup Docker container settings now for Python console so we should bind at least project
// directory to some path inside the Docker container
commandLine.putUserData(PythonRemoteInterpreterManager.ADDITIONAL_MAPPINGS, buildDockerPathMappings());
myRemoteProcessHandlerBase = PyRemoteProcessStarterManagerUtil.getManager(data).startRemoteProcess(myProject, commandLine, manager, data, pathMapper);
myCommandLine = myRemoteProcessHandlerBase.getCommandLine();
RemoteProcess remoteProcess = myRemoteProcessHandlerBase.getProcess();
Couple<Integer> remotePorts = getRemotePortsFromProcess(remoteProcess);
if (remoteProcess instanceof Tunnelable) {
Tunnelable tunnelableProcess = (Tunnelable) remoteProcess;
tunnelableProcess.addLocalTunnel(myPorts[0], remotePorts.first);
tunnelableProcess.addRemoteTunnel(remotePorts.second, "localhost", myPorts[1]);
if (LOG.isDebugEnabled()) {
LOG.debug(String.format("Using tunneled communication for Python console: port %d (=> %d) on IDE side, " + "port %d (=> %d) on pydevconsole.py side", myPorts[1], remotePorts.second, myPorts[0], remotePorts.first));
}
myPydevConsoleCommunication = new PydevRemoteConsoleCommunication(myProject, myPorts[0], remoteProcess, myPorts[1]);
} else {
if (LOG.isDebugEnabled()) {
LOG.debug(String.format("Using direct communication for Python console: port %d on IDE side, port %d on pydevconsole.py side", remotePorts.second, remotePorts.first));
}
myPydevConsoleCommunication = new PydevRemoteConsoleCommunication(myProject, remotePorts.first, remoteProcess, remotePorts.second);
}
return remoteProcess;
} catch (Exception e) {
throw new ExecutionException(e.getMessage(), e);
}
}
use of com.intellij.execution.ExecutionException in project intellij-community by JetBrains.
the class PydevConsoleRunnerImpl method createProcess.
private Process createProcess() throws ExecutionException {
if (PySdkUtil.isRemote(mySdk)) {
PythonRemoteInterpreterManager manager = PythonRemoteInterpreterManager.getInstance();
if (manager != null) {
UsageTrigger.trigger(CONSOLE_FEATURE + ".remote");
return createRemoteConsoleProcess(manager, myGeneralCommandLine.getParametersList().getArray(), myGeneralCommandLine.getEnvironment(), myGeneralCommandLine.getWorkDirectory());
}
throw new PythonRemoteInterpreterManager.PyRemoteInterpreterExecutionException();
} else {
myCommandLine = myGeneralCommandLine.getCommandLineString();
Map<String, String> envs = myGeneralCommandLine.getEnvironment();
EncodingEnvironmentUtil.setLocaleEnvironmentIfMac(envs, myGeneralCommandLine.getCharset());
UsageTrigger.trigger(CONSOLE_FEATURE + ".local");
final Process server = myGeneralCommandLine.createProcess();
try {
myPydevConsoleCommunication = new PydevConsoleCommunication(myProject, myPorts[0], server, myPorts[1]);
} catch (Exception e) {
throw new ExecutionException(e.getMessage());
}
return server;
}
}
Aggregations