Core Library0.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

interface libtmux-ts latest

SpawnOptions

Where a program started by Server.spawn runs, and what it gets.

Source and package
Qualified name
SpawnOptions
Module
types
Package
libtmux
Source
packages/libtmux/src/types.ts
interface types.SpawnOptions

Description#

The program gets a pane of its own and a real terminal. It runs on the machine the tmux server is on, with the tmux server's environment, except PATH: tmux gives a pane the PATH of the client that asked for it, which is this process's, or ServerOptions.environment 's when that is set. stderr shares the screen with stdout, and without input the terminal is its stdin, so a program that pages or prompts (git log, sudo) waits for keys as it would in a terminal.

Members13#

  • environment: Readonly<Record<string, string>> property Variables added to the program's environment. They reach tmux as command arguments, which ps on this machine shows while the command runs; pass a secret through input instead. tmux replaces a PATH passed that way with its client's, so the wrapper sets this one itself before finding argv[0].
  • from: Pane property The pane to run beside: the program starts in its current directory, in its session, with that session's tmux environment. Variables the pane's shell exported are not inherited; only typing into that shell reaches them.
  • height: number property Terminal height in rows, for "session". Defaults to tmux's default-size.
  • historyLimit: number property Lines of scrollback kept for Program.output , for "session", up to tmux's 2147483647. Defaults to 100000; older lines are dropped, and ProgramResult.lostStart says so. It bounds the output too: at most this many rows plus the screen's, each width columns, the newest kept.
  • input: string | Uint8Array property The program's stdin, as bytes or UTF-8 text. It is written to a private file the program reads, so it passes through no shell or tmux command, and the terminal stays the program's output. Needs the tmux server on this machine, as stream does.
  • keep: boolean property Leave the pane in place once the program has ended, showing its output, for a person to read; it is theirs to close. A kept split closes at the next key pressed in it. Program.kill and await using still end a running program.
  • maxStreamBytes: number property Stop the copy after this many bytes; Program.stream then yields them and throws StreamLimitError . The program runs on. No limit by default, and the temporary directory may be memory-backed.
  • orphanAfterMs: number | null property Have tmux end the program, and remove its pane unless keep is set, this many milliseconds after this process stops renewing a lease on it: after it exits or dies without Program.kill . A live process renews the lease every third of this period. At least 1000; 60000 by default. null takes no lease, for a program meant to outlive this process. Renewals run on the event loop, so a stall longer than this, such as a debugger paused at a breakpoint, ends the program too; raise it, or pass null , there.
  • placement: ProgramPlacement property "session", the default without from , is a detached session of the program's own. With from , "window", the default, is a background window of that pane's session, and "split" splits that pane, leaving focus where it was.
  • signal: AbortLike property Stops setup: an abort before the program has started removes its pane and rejects with TmuxTransportError of kind cancelled, whose delivery is not_started if nothing was made and indeterminate if the program may have begun. Once Server.spawn has returned, the program is the caller's to end.
  • startDirectory: string property Directory the program starts in, taken as a literal path. Defaults to this process's current directory, or the from pane's. One that cannot be entered means the program never runs: see ProgramStartError .
  • stream: boolean property Copy everything the program writes, so Program.stream can return all of it. Needs the tmux server on this machine: the copy is a file in this process's temporary directory.
  • width: number property Terminal width in columns, for "session". Defaults to tmux's default-size.
Esc

Type to search.

Reference previewOpen reference