mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Close the pty if the session creation failed.
This commit is contained in:
parent
6f82c41296
commit
7729196702
2 changed files with 42 additions and 12 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2006-04-21 Mikhail Khodjaiants
|
||||||
|
Close the pty if the session creation failed.
|
||||||
|
* MIPlugin.java
|
||||||
|
|
||||||
2006-04-18 Mikhail Khodjaiants
|
2006-04-18 Mikhail Khodjaiants
|
||||||
Duplicate message key.
|
Duplicate message key.
|
||||||
* MIPluginResources.properties
|
* MIPluginResources.properties
|
||||||
|
|
|
@ -434,23 +434,49 @@ public class MIPlugin extends Plugin {
|
||||||
}
|
}
|
||||||
String[] args = (String[])argList.toArray(new String[argList.size()]);
|
String[] args = (String[])argList.toArray(new String[argList.size()]);
|
||||||
int launchTimeout = MIPlugin.getDefault().getPluginPreferences().getInt(IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT);
|
int launchTimeout = MIPlugin.getDefault().getPluginPreferences().getInt(IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT);
|
||||||
MIProcess pgdb = new MIProcessAdapter(args, launchTimeout, monitor);
|
|
||||||
|
|
||||||
if (MIPlugin.getDefault().isDebugging()) {
|
MISession miSession = null;
|
||||||
StringBuffer sb = new StringBuffer();
|
MIProcess pgdb = null;
|
||||||
for (int i = 0; i < args.length; ++i) {
|
boolean failed = false;
|
||||||
sb.append(args[i]);
|
|
||||||
sb.append(' ');
|
|
||||||
}
|
|
||||||
MIPlugin.getDefault().debugLog(sb.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
MISession miSession;
|
|
||||||
try {
|
try {
|
||||||
|
pgdb = new MIProcessAdapter(args, launchTimeout, monitor);
|
||||||
|
|
||||||
|
if (MIPlugin.getDefault().isDebugging()) {
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
for (int i = 0; i < args.length; ++i) {
|
||||||
|
sb.append(args[i]);
|
||||||
|
sb.append(' ');
|
||||||
|
}
|
||||||
|
MIPlugin.getDefault().debugLog(sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
miSession = createMISession0(sessionType, pgdb, factory, pty, getCommandTimeout());
|
miSession = createMISession0(sessionType, pgdb, factory, pty, getCommandTimeout());
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
pgdb.destroy();
|
failed = true;
|
||||||
throw e;
|
throw e;
|
||||||
|
} catch(IOException e ) {
|
||||||
|
failed = true;
|
||||||
|
throw e;
|
||||||
|
} finally {
|
||||||
|
if (failed) {
|
||||||
|
// Kill gdb
|
||||||
|
if ( pgdb != null )
|
||||||
|
pgdb.destroy();
|
||||||
|
// Shutdown the pty console.
|
||||||
|
if (pty != null) {
|
||||||
|
try {
|
||||||
|
OutputStream out = pty.getOutputStream();
|
||||||
|
if (out != null) {
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
|
InputStream in = pty.getInputStream();
|
||||||
|
if (in != null) {
|
||||||
|
in.close();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Session(miSession);
|
return new Session(miSession);
|
||||||
|
|
Loading…
Add table
Reference in a new issue