Skip to content

Interface: PtyProcess

@termwright/driver/experimental


@termwright/driver/experimental / PtyProcess

Defined in: pty.ts:19

A live pseudo-terminal hosting one child process.

readonly optional lifecycle?: object

Defined in: pty.ts:22

Truthful lifecycle properties when the backend can prove them.

readonly outputDrain: "eof" | "bounded-fallback"

readonly tree: "posix-process-group" | "conpty-console" | "delegated"


readonly optional outputEnded?: Promise<void>

Defined in: pty.ts:64

Settles once the backend’s output producer can deliver no more bytes.


readonly pid: number

Defined in: pty.ts:20


readonly optional sawOutputEnd?: () => 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.

boolean

optional attach(signal): Promise<void>

Defined in: pty.ts:71

Settles once an asynchronously created native session is ready for lifecycle operations.

AbortSignal

Promise<void>


optional closeInput(): void

Defined in: pty.ts:48

Closes owned terminal input without disposing the output producer.

void


dispose(): void

Defined in: pty.ts:81

Idempotent finalizer; hangs up a live PTY before releasing listeners.

void


optional hardKillTree(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.

AbortSignal

Promise<void>


optional killOwnedTreeAtExitBoundary(): void

Defined in: pty.ts:53

Synchronously closes the owned POSIX group at the root-exit boundary.

void


onData(cb): PtyUnsubscribe

Defined in: pty.ts:61

(data) => void

PtyUnsubscribe


onExit(cb): PtyUnsubscribe

Defined in: pty.ts:62

(status) => void

PtyUnsubscribe


optional onWriteDrain(cb): PtyUnsubscribe

Defined in: pty.ts:75

Queue-drained notification; it does not claim child consumption.

() => void

PtyUnsubscribe


optional onWriteError(cb): PtyUnsubscribe

Defined in: pty.ts:73

Fatal asynchronous failures after write() accepted bytes.

(error) => void

PtyUnsubscribe


optional ownedProcessResources(): OwnedProcessResourceUsage | null

Defined in: pty.ts:79

Native whole-tree accounting, when the ownership primitive supports it.

OwnedProcessResourceUsage | null


resize(columns, rows): void

Defined in: pty.ts:49

number

number

void


signal(sig): void

Defined in: pty.ts:51

Delivers a POSIX signal. On Windows only KILL is supported.

PtySignal

void


optional terminate(): void

Defined in: pty.ts:55

Backend-native graceful lifecycle request; required when tree ownership is delegated.

void


optional treeState(): "alive" | "gone" | "unsupported"

Defined in: pty.ts:77

Liveness of the owned tree, when the backend has an OS primitive for it.

"alive" | "gone" | "unsupported"


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.

Uint8Array

"key" | "mouse" | "paste" | "raw"

void


optional writeTerminalResponse(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.

Uint8Array

"host-control" | "application-envelope" | "application-direct"