PseudoTerminal
classin packageklyn.process
public class PseudoTerminal:
PseudoTerminal

Interactive pseudo-terminal backed by the operating system terminal API.

PseudoTerminal is intended for embedded terminals and interactive tools: shells, Python REPLs, debuggers, package managers and any process that expects a real TTY instead of plain redirected pipes.

Example
pty = PseudoTerminal()
pty.write("python3 -i\n")
output = pty.readAvailable()
Properties
Modifier and Type Member Description
public readonly property isRunning
isRunning as Boolean:
Indicates whether the terminal child process is still running.
Constructors
Modifier and Type Member Description
public PseudoTerminal
PseudoTerminal(command as String = "", cwd as String = "", columns as Int = 80, rows as Int = 24):
Starts a new pseudo-terminal.
Methods
Modifier and Type Member Description
public close
close() as Void:
Closes the terminal and terminates the child process if it is still alive.
public readAvailable
readAvailable() as String:
Reads all output currently available without blocking the GUI thread.
public resize
resize(columns as Int, rows as Int) as Void:
Resizes the terminal grid.
public start
start(command as String = "", cwd as String = "") as Void:
Starts the terminal process.
public write
write(text as String) as Void:
Writes text to the terminal input stream.