monitor = new NullProgressMonitor();
IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 5);
subMonitor.beginTask("Launching python", 1);
// Launch & connect to the debugger
RemoteDebugger debugger = new RemoteDebugger();
debugger.startConnect(subMonitor, config);
subMonitor.subTask("Constructing command_line...");
String[] cmdLine = config.getCommandLine(true);
Process p = createProcess(launch, config.envp, cmdLine, config.workingDirectory);
HashMap<Object, Object> processAttributes = new HashMap<Object, Object>();
processAttributes.put(IProcess.ATTR_CMDLINE, config.getCommandLineAsString());
processAttributes.put(Constants.PYDEV_DEBUG_IPROCESS_ATTR, Constants.PYDEV_DEBUG_IPROCESS_ATTR_TRUE);
//Set the debug target before registering with the debug plugin (we want it before creating the console).
PyDebugTarget t = new PyDebugTarget(launch, null, config.resource, debugger, config.project);
IProcess process;
try {
process = registerWithDebugPluginForProcessType(config.getRunningName(), launch, p, processAttributes,
config);
t.process = process;
} finally {
t.finishedInit = true;
}
subMonitor.subTask("Waiting for connection...");
Socket socket = null;
try {
socket = debugger.waitForConnect(subMonitor, p, process);
if (socket == null) {
debugger.dispose();
return;
}
} catch (Exception ex) {
process.terminate();
p.destroy();