diff --git a/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/utils/pty/PTY.java b/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/utils/pty/PTY.java
index 55431dee60c..9eabae7758c 100644
--- a/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/utils/pty/PTY.java
+++ b/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/utils/pty/PTY.java
@@ -39,7 +39,7 @@ public class PTY {
TERMINAL
}
- final boolean console;
+ final Mode mode;
final String slave;
final PTYInputStream in;
final PTYOutputStream out;
@@ -72,6 +72,7 @@ public class PTY {
/**
* @return whether PTY support for console mode is available on this platform
*/
+ @Deprecated
public static boolean isSupported() {
return isSupported(Mode.CONSOLE);
}
@@ -86,7 +87,7 @@ public class PTY {
/**
* Create PTY for use with Eclipse console.
- * Identical to {@link PTY#PTY(boolean) PTY(Mode.CONSOLE)}.
+ * Identical to {@link PTY#PTY(Mode.CONSOLE)}.
*/
public PTY() throws IOException {
this(Mode.CONSOLE);
@@ -114,39 +115,11 @@ public class PTY {
* @since 5.6
*/
public PTY(Mode mode) throws IOException {
- this(mode == Mode.CONSOLE);
- }
-
- /**
- * Create pseudo terminal.
- *
- *
- * The provided flag indicates whether the pseudo terminal is used with the interactive
- * Eclipse console:
- *
- * - If
true
the terminal is configured with no echo and stderr is
- * redirected to a pipe instead of the PTY. This mode is not supported on windows
- * - If
false
the terminal is configured with echo and stderr is
- * connected to the PTY. This mode is best suited for use with a proper terminal emulation.
- * Note that this mode might not be supported on all platforms.
- * Known platforms which support this mode are:
- * linux-x86
, linux-x86_64
, solaris-sparc
, macosx
.
- *
- *
- *
- *
- * @param console whether terminal is used with Eclipse console
- * @throws IOException if the PTY could not be created
- * @deprecated Use {@link #PTY(Mode)} instead
- * @since 5.2
- */
- @Deprecated
- public PTY(boolean console) throws IOException {
- this.console = console;
- if (console && !isConsoleModeSupported) {
+ this.mode = mode;
+ if (isConsole() && !isConsoleModeSupported) {
throw new IOException(Messages.Util_exception_cannotCreatePty);
}
- slave = hasPTY ? openMaster(console) : null;
+ slave = hasPTY ? openMaster(isConsole()) : null;
if (slave == null) {
throw new IOException(Messages.Util_exception_cannotCreatePty);
@@ -165,8 +138,9 @@ public class PTY {
public void validateSlaveName() throws IOException {
// on windows the slave name is just an internal identifier
// and does not represent a real device
- if (isWinPTY)
+ if (isWinPTY) {
throw new IOException("Slave name is not valid"); //$NON-NLS-1$
+ }
}
public String getSlaveName() {
@@ -183,7 +157,7 @@ public class PTY {
* @since 5.2
*/
public final boolean isConsole() {
- return console;
+ return mode == Mode.CONSOLE;
}
public PTYOutputStream getOutputStream() {
@@ -227,9 +201,9 @@ public class PTY {
public int exec_pty(Spawner spawner, String[] cmdarray, String[] envp, String dir, IChannel[] chan)
throws IOException {
if (isWinPTY) {
- return exec2(cmdarray, envp, dir, chan, slave, master, console);
+ return exec2(cmdarray, envp, dir, chan, slave, master, isConsole());
} else {
- return spawner.exec2(cmdarray, envp, dir, chan, slave, master, console);
+ return spawner.exec2(cmdarray, envp, dir, chan, slave, master, isConsole());
}
}
diff --git a/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/utils/pty/PTYInputStream.java b/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/utils/pty/PTYInputStream.java
index eeebd1a097c..ed0410a2310 100644
--- a/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/utils/pty/PTYInputStream.java
+++ b/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/utils/pty/PTYInputStream.java
@@ -20,7 +20,10 @@ import java.io.InputStream;
import org.eclipse.cdt.utils.pty.PTY.MasterFD;
-class PTYInputStream extends InputStream {
+/**
+ * @since 6.0
+ */
+public class PTYInputStream extends InputStream {
MasterFD master;
diff --git a/debug/org.eclipse.cdt.debug.application.tests/src/org/eclipse/cdt/debug/application/tests/Utilities.java b/debug/org.eclipse.cdt.debug.application.tests/src/org/eclipse/cdt/debug/application/tests/Utilities.java
index 17f3ead4d69..865fc28e393 100644
--- a/debug/org.eclipse.cdt.debug.application.tests/src/org/eclipse/cdt/debug/application/tests/Utilities.java
+++ b/debug/org.eclipse.cdt.debug.application.tests/src/org/eclipse/cdt/debug/application/tests/Utilities.java
@@ -170,7 +170,7 @@ public class Utilities {
if (workDir == null) {
return ProcessFactory.getFactory().exec(commandArray, envp);
}
- if (PTY.isSupported() && usePty) {
+ if (PTY.isSupported(PTY.Mode.CONSOLE) && usePty) {
return ProcessFactory.getFactory().exec(commandArray, envp, workDir, new PTY());
} else {
return ProcessFactory.getFactory().exec(commandArray, envp, workDir);
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/LocalRunLaunchDelegate.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/LocalRunLaunchDelegate.java
index b7e28b2eb29..3cb097e99cb 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/LocalRunLaunchDelegate.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/LocalRunLaunchDelegate.java
@@ -280,7 +280,7 @@ public class LocalRunLaunchDelegate extends AbstractCLaunchDelegate2 {
*/
protected Process exec(String[] cmdLine, String[] environ, File workingDirectory) throws CoreException {
try {
- if (PTY.isSupported()) {
+ if (PTY.isSupported(PTY.Mode.CONSOLE)) {
return ProcessFactory.getFactory().exec(cmdLine, environ, workingDirectory, new PTY());
} else {
return ProcessFactory.getFactory().exec(cmdLine, environ, workingDirectory);
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java
index b422c227974..dbcb8f5ee42 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java
@@ -152,7 +152,7 @@ public class CMainTab extends CAbstractMainTab {
updateLaunchConfigurationDialog();
}
});
- fTerminalButton.setEnabled(PTY.isSupported());
+ fTerminalButton.setEnabled(PTY.isSupported(PTY.Mode.CONSOLE));
}
@Override
diff --git a/terminal/plugins/org.eclipse.tm.terminal.connector.process/src/org/eclipse/tm/terminal/connector/process/ProcessSettings.java b/terminal/plugins/org.eclipse.tm.terminal.connector.process/src/org/eclipse/tm/terminal/connector/process/ProcessSettings.java
index 97a7084b7e0..48b55a0b4fc 100644
--- a/terminal/plugins/org.eclipse.tm.terminal.connector.process/src/org/eclipse/tm/terminal/connector/process/ProcessSettings.java
+++ b/terminal/plugins/org.eclipse.tm.terminal.connector.process/src/org/eclipse/tm/terminal/connector/process/ProcessSettings.java
@@ -32,7 +32,7 @@ public class ProcessSettings {
private PTY pty;
// Flag to control the local echo (defaults to true if
// the PTY is not supported on the current host platform)
- private boolean localEcho = !PTY.isSupported();
+ private boolean localEcho = !PTY.isSupported(PTY.Mode.CONSOLE);
// The line separator setting
private String lineSeparator = null;
// The list of stdout output listeners
diff --git a/terminal/plugins/org.eclipse.tm.terminal.connector.process/src/org/eclipse/tm/terminal/connector/process/ProcessSettingsPage.java b/terminal/plugins/org.eclipse.tm.terminal.connector.process/src/org/eclipse/tm/terminal/connector/process/ProcessSettingsPage.java
index e32b905c6b2..3560c2021bc 100644
--- a/terminal/plugins/org.eclipse.tm.terminal.connector.process/src/org/eclipse/tm/terminal/connector/process/ProcessSettingsPage.java
+++ b/terminal/plugins/org.eclipse.tm.terminal.connector.process/src/org/eclipse/tm/terminal/connector/process/ProcessSettingsPage.java
@@ -113,7 +113,7 @@ public class ProcessSettingsPage extends AbstractSettingsPage {
localEchoSelectorControl = new Button(composite, SWT.CHECK);
localEchoSelectorControl.setText(Messages.ProcessSettingsPage_localEchoSelectorControl_label);
localEchoSelectorControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- localEchoSelectorControl.setSelection(!PTY.isSupported());
+ localEchoSelectorControl.setSelection(!PTY.isSupported(PTY.Mode.CONSOLE));
// Initialize the control content
loadSettings();