Interface: PtyProcess
@termwright/driver/experimental
@termwright/driver/experimental / PtyProcess
Interface: PtyProcess
Section titled “Interface: PtyProcess”Defined in: pty.ts:19
A live pseudo-terminal hosting one child process.
Properties
Section titled “Properties”lifecycle?
Section titled “lifecycle?”
readonlyoptionallifecycle?:object
Defined in: pty.ts:22
Truthful lifecycle properties when the backend can prove them.
outputDrain
Section titled “outputDrain”
readonlyoutputDrain:"eof"|"bounded-fallback"
readonlytree:"posix-process-group"|"conpty-console"|"delegated"
outputEnded?
Section titled “outputEnded?”
readonlyoptionaloutputEnded?:Promise<void>
Defined in: pty.ts:64
Settles once the backend’s output producer can deliver no more bytes.
readonlypid:number
Defined in: pty.ts:20
sawOutputEnd?
Section titled “sawOutputEnd?”
readonlyoptionalsawOutputEnd?: () =>boolean
Defined in: pty.ts:69
Whether the producer reached its authoritative EOF rather than being torn
down with bytes potentially unread. outputEnded settles in both cases.
Returns
Section titled “Returns”boolean
Methods
Section titled “Methods”attach()?
Section titled “attach()?”
optionalattach(signal):Promise<void>
Defined in: pty.ts:71
Settles once an asynchronously created native session is ready for lifecycle operations.
Parameters
Section titled “Parameters”signal
Section titled “signal”AbortSignal
Returns
Section titled “Returns”Promise<void>
closeInput()?
Section titled “closeInput()?”
optionalcloseInput():void
Defined in: pty.ts:48
Closes owned terminal input without disposing the output producer.
Returns
Section titled “Returns”void
dispose()
Section titled “dispose()”dispose():
void
Defined in: pty.ts:81
Idempotent finalizer; hangs up a live PTY before releasing listeners.
Returns
Section titled “Returns”void
hardKillTree()?
Section titled “hardKillTree()?”
optionalhardKillTree(signal):Promise<void>
Defined in: pty.ts:60
Hard-kills an owned process tree. The operation must reject promptly when
signal is aborted; dispose must settle any backend work started by it.
Parameters
Section titled “Parameters”signal
Section titled “signal”AbortSignal
Returns
Section titled “Returns”Promise<void>
killOwnedTreeAtExitBoundary()?
Section titled “killOwnedTreeAtExitBoundary()?”
optionalkillOwnedTreeAtExitBoundary():void
Defined in: pty.ts:53
Synchronously closes the owned POSIX group at the root-exit boundary.
Returns
Section titled “Returns”void
onData()
Section titled “onData()”onData(
cb):PtyUnsubscribe
Defined in: pty.ts:61
Parameters
Section titled “Parameters”(data) => void
Returns
Section titled “Returns”onExit()
Section titled “onExit()”onExit(
cb):PtyUnsubscribe
Defined in: pty.ts:62
Parameters
Section titled “Parameters”(status) => void
Returns
Section titled “Returns”onWriteDrain()?
Section titled “onWriteDrain()?”
optionalonWriteDrain(cb):PtyUnsubscribe
Defined in: pty.ts:75
Queue-drained notification; it does not claim child consumption.
Parameters
Section titled “Parameters”() => void
Returns
Section titled “Returns”onWriteError()?
Section titled “onWriteError()?”
optionalonWriteError(cb):PtyUnsubscribe
Defined in: pty.ts:73
Fatal asynchronous failures after write() accepted bytes.
Parameters
Section titled “Parameters”(error) => void
Returns
Section titled “Returns”ownedProcessResources()?
Section titled “ownedProcessResources()?”
optionalownedProcessResources():OwnedProcessResourceUsage|null
Defined in: pty.ts:79
Native whole-tree accounting, when the ownership primitive supports it.
Returns
Section titled “Returns”OwnedProcessResourceUsage | null
resize()
Section titled “resize()”resize(
columns,rows):void
Defined in: pty.ts:49
Parameters
Section titled “Parameters”columns
Section titled “columns”number
number
Returns
Section titled “Returns”void
signal()
Section titled “signal()”signal(
sig):void
Defined in: pty.ts:51
Delivers a POSIX signal. On Windows only KILL is supported.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
terminate()?
Section titled “terminate()?”
optionalterminate():void
Defined in: pty.ts:55
Backend-native graceful lifecycle request; required when tree ownership is delegated.
Returns
Section titled “Returns”void
treeState()?
Section titled “treeState()?”
optionaltreeState():"alive"|"gone"|"unsupported"
Defined in: pty.ts:77
Liveness of the owned tree, when the backend has an OS primitive for it.
Returns
Section titled “Returns”"alive" | "gone" | "unsupported"
write()
Section titled “write()”write(
data,kind?):void
Defined in: pty.ts:32
Queues raw bytes in the backend’s ordered input stream. Never appends a newline. A successful return proves queue admission, not child consumption; semantic actions prove consumption through their committed postcondition.
Parameters
Section titled “Parameters”Uint8Array
"key" | "mouse" | "paste" | "raw"
Returns
Section titled “Returns”void
writeTerminalResponse()?
Section titled “writeTerminalResponse()?”
optionalwriteTerminalResponse(data):"host-control"|"application-envelope"|"application-direct"
Defined in: pty.ts:44
Queues bytes generated by the terminal emulator in response to a terminal query. ConPTY backends use this distinct path so the pinned host’s private, request-addressed cursor RPC remains distinguishable from ordinary application replies. The Windows application route wraps each complete response in the pinned host’s private atomic envelope; other backends may write the response directly.
Backends without a separate terminal-response transport may omit this method; the driver then uses write.
Parameters
Section titled “Parameters”Uint8Array
Returns
Section titled “Returns”"host-control" | "application-envelope" | "application-direct"