public class PTY extends Object
Modifier and Type | Class and Description |
---|---|
class |
PTY.MasterFD
The master fd is used on two streams.
|
static class |
PTY.Mode
The pty modes.
|
Constructor and Description |
---|
PTY()
Create PTY for use with Eclipse console.
|
PTY(boolean console)
Deprecated.
Use
PTY(Mode) instead |
PTY(PTY.Mode mode)
Create PTY for given mode.
|
Modifier and Type | Method and Description |
---|---|
int |
exec_pty(Spawner spawner,
String[] cmdarray,
String[] envp,
String dir,
int[] chan) |
org.eclipse.cdt.utils.pty.PTYInputStream |
getInputStream() |
PTY.MasterFD |
getMasterFD() |
PTYOutputStream |
getOutputStream() |
String |
getSlaveName() |
boolean |
isConsole() |
static boolean |
isSupported() |
static boolean |
isSupported(PTY.Mode mode) |
void |
setTerminalSize(int width,
int height)
Change terminal window size to given width and height.
|
void |
validateSlaveName()
Test whether the slave name can be used as a tty device by external processes (e.g.
|
int |
waitFor(Spawner spawner,
int pid) |
public PTY() throws IOException
PTY(Mode.CONSOLE)
.IOException
public PTY(PTY.Mode mode) throws IOException
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
.
mode
- the desired mode of operationIOException
- if the PTY could not be created@Deprecated public PTY(boolean console) throws IOException
PTY(Mode)
insteadThe provided flag indicates whether the pseudo terminal is used with the interactive Eclipse console:
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 windowsfalse
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
.
console
- whether terminal is used with Eclipse consoleIOException
- if the PTY could not be createdpublic static boolean isSupported()
public static boolean isSupported(PTY.Mode mode)
public void validateSlaveName() throws IOException
IOException
- if the slave name is not validpublic String getSlaveName()
public PTY.MasterFD getMasterFD()
public final boolean isConsole()
public PTYOutputStream getOutputStream()
public org.eclipse.cdt.utils.pty.PTYInputStream getInputStream()
public final void setTerminalSize(int width, int height)
This should only be used when the pseudo terminal is configured
for use with a terminal emulation, i.e. when isConsole()
returns false
.
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
.
public int exec_pty(Spawner spawner, String[] cmdarray, String[] envp, String dir, int[] chan) throws IOException
IOException
public int waitFor(Spawner spawner, int pid)
Copyright (c) IBM Corp. and others 2004, 2020. All Rights Reserved.