Package org.eclipse.cdt.utils.pty
Class PTY
- java.lang.Object
-
- org.eclipse.cdt.utils.pty.PTY
-
- Direct Known Subclasses:
PersistentPTY
public class PTY extends java.lang.ObjectPTY - pseudo terminal support.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classPTY.MasterFDThe master fd is used on two streams.static classPTY.ModeThe pty modes.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description intexec_pty(Spawner spawner, java.lang.String[] cmdarray, java.lang.String[] envp, java.lang.String dir, Spawner.IChannel[] chan)PTYInputStreamgetInputStream()PTY.MasterFDgetMasterFD()PTYOutputStreamgetOutputStream()java.lang.StringgetSlaveName()booleanisConsole()static booleanisSupported()Deprecated.static booleanisSupported(PTY.Mode mode)voidsetTerminalSize(int width, int height)Change terminal window size to given width and height.voidvalidateSlaveName()Test whether the slave name can be used as a tty device by external processes (e.g.intwaitFor(Spawner spawner, int pid)
-
-
-
Constructor Detail
-
PTY
public PTY() throws java.io.IOExceptionCreate PTY for use with Eclipse console. Identical toPTY#PTY(Mode.CONSOLE).- Throws:
java.io.IOException
-
PTY
public PTY(PTY.Mode mode) throws java.io.IOException
Create PTY for given mode.The provided mode indicates whether the pseudo terminal is used with the interactive Eclipse console or a terminal emulation:
CONSOLE- the terminal is configured with no echo and stderr is redirected to a pipe instead of the PTY. This mode is not supported on windowsTERMINAL- 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.
- Parameters:
mode- the desired mode of operation- Throws:
java.io.IOException- if the PTY could not be created- Since:
- 5.6
-
-
Method Detail
-
isSupported
@Deprecated public static boolean isSupported()
Deprecated.- Returns:
- whether PTY support for console mode is available on this platform
-
isSupported
public static boolean isSupported(PTY.Mode mode)
- Returns:
- whether PTY support for given mode is available on this platform
- Since:
- 5.6
-
validateSlaveName
public void validateSlaveName() throws java.io.IOExceptionTest whether the slave name can be used as a tty device by external processes (e.g. gdb). If the slave name is not valid an IOException is thrown.- Throws:
java.io.IOException- if the slave name is not valid- Since:
- 5.6
-
getSlaveName
public java.lang.String getSlaveName()
-
getMasterFD
public PTY.MasterFD getMasterFD()
-
isConsole
public final boolean isConsole()
- Returns:
- whether this pseudo terminal is for use with the Eclipse console.
- Since:
- 5.2
-
getOutputStream
public PTYOutputStream getOutputStream()
-
getInputStream
public PTYInputStream getInputStream()
-
setTerminalSize
public final void setTerminalSize(int width, int height)Change terminal window size to given width and height.This should only be used when the pseudo terminal is configured for use with a terminal emulation, i.e. when
isConsole()returnsfalse.Note: This method may not be supported on all platforms. Known platforms which support this method are:
linux-x86,linux-x86_64,solaris-sparc,macosx.- Since:
- 5.2
-
exec_pty
public int exec_pty(Spawner spawner, java.lang.String[] cmdarray, java.lang.String[] envp, java.lang.String dir, Spawner.IChannel[] chan) throws java.io.IOException
- Throws:
java.io.IOException- Since:
- 5.6
- Restriction:
- This method is not intended to be referenced by clients.
-
waitFor
public int waitFor(Spawner spawner, int pid)
- Since:
- 5.6
- Restriction:
- This method is not intended to be referenced by clients.
-
-