mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 21:05:37 +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
|
* @throws MIException
|
||||||
*/
|
*/
|
||||||
public ICDISession createCSession(String gdb, String program) throws IOException, 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) {
|
if (gdb == null || gdb.length() == 0) {
|
||||||
gdb = "gdb";
|
gdb = "gdb";
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] args;
|
String[] args;
|
||||||
PTY pty = null;
|
if (pty != null) {
|
||||||
try {
|
args = new String[] {gdb, "-q", "-nw", "-tty", pty.getSlaveName(), "-i", "mi1", program};
|
||||||
pty = new PTY();
|
} else {
|
||||||
String ttyName = pty.getSlaveName();
|
|
||||||
args = new String[] {gdb, "-q", "-nw", "-tty", ttyName, "-i", "mi1", program};
|
|
||||||
} catch (IOException e) {
|
|
||||||
//e.printStackTrace();
|
|
||||||
pty = null;
|
|
||||||
args = new String[] {"gdb", "-q", "-nw", "-i", "mi1", program};
|
args = new String[] {"gdb", "-q", "-nw", "-i", "mi1", program};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue