ScriptPtyShellSession class

A ShellSession backed by a real pseudo-terminal allocated by the system script(1) utility, which runs as an ordinary child Process.

Unlike the FFI-based PtyShellSession (which loads the portable_pty native library), all PTY ownership — forkpty, the controlling terminal and signal handling — lives inside the script process. The node only does pipe I/O and reaps a normal child, so this backend cannot trigger the native SIGCHLD crash that affects portable_pty.

script bridges the child's tty to its own stdin/stdout, so:

  • stdout is the merged terminal output (the pty folds stderr into stdout);
  • writeStdin feeds the child's tty input;
  • exitCode is the child's exit status, surfaced by script.

Limitation: script launched from pipes has no controlling terminal of its own, so resize cannot propagate to the child and is a no-op. The initial geometry is seeded once by the backend (via stty rows/cols before exec).

Implemented types

Constructors

ScriptPtyShellSession(Process _process)
Wraps an already-started script Process.

Properties

exitCode Future<int>
Completes with the process exit code once it terminates.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
pid int?
The backend process id, if known.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shellFamily ShellFamily
The command-language family of the launched shell, so the client can speak the matching marker/command dialect over an interactive session.
no setteroverride
stderr Stream<Uint8List>
Bytes written by the process to standard error.
no setteroverride
stdout Stream<Uint8List>
Bytes written by the process to standard output.
no setteroverride

Methods

closeStdin() Future<void>
Signals end-of-input on standard input (half-close).
override
kill() Future<void>
Forcibly terminates the process and releases resources.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resize({required int cols, required int rows}) → void
Resizes the terminal, where the backend supports it (no-op otherwise).
override
sendSignal(String signal) → void
Sends a POSIX signal name (e.g. SIGINT, SIGTERM) to the process.
override
toString() String
A string representation of this object.
inherited
writeStdin(List<int> data) → void
Writes data to the process's standard input.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited