Class CygwinPty
java.lang.Object
org.aesh.terminal.tty.impl.AbstractExecPty
org.aesh.terminal.tty.impl.CygwinPty
- All Implemented Interfaces:
Closeable, AutoCloseable, Pty
PTY implementation for Cygwin environments on Windows.
This class provides pseudo-terminal support when running under Cygwin.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()static Ptycurrent()Returns the PTY for the current terminal.protected StringRetrieves the terminal configuration using the stty command.org.aesh.terminal.AttributesgetAttr()Returns the current terminal attributes.org.aesh.terminal.tty.SizegetSize()Returns the current terminal size.Returns the slave side input stream.Returns the slave side output stream.protected intRead the raw Windows console input mode.voidsetAttr(org.aesh.terminal.Attributes attr) Sets the terminal attributes.protected voidwriteConsoleMode(int mode) Write the raw Windows console input mode.Methods inherited from class AbstractExecPty
exec, getMasterInput, getMasterOutput, getNameMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Pty
peek, read, read, supportsNonBlockingRead
-
Constructor Details
-
CygwinPty
Constructs a CygwinPty with the specified TTY name.- Parameters:
name- the name of the TTY device
-
-
Method Details
-
current
Returns the PTY for the current terminal.- Returns:
- the current PTY for the current terminal
- Throws:
IOException- if not running in a TTY or an I/O error occurs
-
getSlaveInput
Description copied from interface:PtyReturns the slave side input stream.- Returns:
- the slave input stream
-
getSlaveOutput
Description copied from interface:PtyReturns the slave side output stream.- Returns:
- the slave output stream
-
getAttr
Description copied from interface:PtyReturns the current terminal attributes.- Returns:
- the terminal attributes
- Throws:
IOException- if an I/O error occurs
-
setAttr
Description copied from interface:PtySets the terminal attributes.- Parameters:
attr- the attributes to set- Throws:
IOException- if an I/O error occurs
-
getSize
Description copied from interface:PtyReturns the current terminal size.- Returns:
- the terminal size
- Throws:
IOException- if an I/O error occurs
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classAbstractExecPty
-
readConsoleMode
protected int readConsoleMode()Read the raw Windows console input mode. Protected for testing.- Returns:
- the console mode flags, or -1 if no console is present
-
writeConsoleMode
protected void writeConsoleMode(int mode) Write the raw Windows console input mode. Protected for testing.- Parameters:
mode- the console mode flags to set
-
doGetConfig
Retrieves the terminal configuration using the stty command.- Returns:
- the terminal configuration string
- Throws:
IOException- if an I/O error occurs
-