From 426a675867d1f2cd34e447d5e71b597d1059be76 Mon Sep 17 00:00:00 2001 From: Alain Magloire Date: Wed, 9 Oct 2002 13:38:21 +0000 Subject: [PATCH] move the creation of pty into a higher another method. --- .../eclipse/cdt/debug/mi/core/MIPlugin.java | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java index 59e79ba8db4..4b033b55a18 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java +++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java @@ -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}; }