mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
move the creation of pty into a higher another method.
This commit is contained in:
parent
f5456b1ad1
commit
426a675867
1 changed files with 19 additions and 8 deletions
|
@ -78,19 +78,30 @@ public class MIPlugin extends Plugin {
|
|||
* @throws MIException
|
||||
*/
|
||||
public ICDISession createCSession(String gdb, String program) throws IOException, MIException {
|
||||
PTY pty = null;
|
||||
try {
|
||||
pty = new PTY();
|
||||
String ttyName = pty.getSlaveName();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
return createCSession(gdb, program, pty);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method createCSession.
|
||||
* @param program
|
||||
* @return ICDISession
|
||||
* @throws IOException
|
||||
*/
|
||||
public ICDISession createCSession(String gdb, String program, PTY pty) throws IOException, MIException {
|
||||
if (gdb == null || gdb.length() == 0) {
|
||||
gdb = "gdb";
|
||||
}
|
||||
|
||||
String[] args;
|
||||
PTY pty = null;
|
||||
try {
|
||||
pty = new PTY();
|
||||
String ttyName = pty.getSlaveName();
|
||||
args = new String[] {gdb, "-q", "-nw", "-tty", ttyName, "-i", "mi1", program};
|
||||
} catch (IOException e) {
|
||||
//e.printStackTrace();
|
||||
pty = null;
|
||||
if (pty != null) {
|
||||
args = new String[] {gdb, "-q", "-nw", "-tty", pty.getSlaveName(), "-i", "mi1", program};
|
||||
} else {
|
||||
args = new String[] {"gdb", "-q", "-nw", "-i", "mi1", program};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue