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.

MoreLess about this notice

typealias libtmux-ts

ShellCommandResult

The outcome and bounded output of a command run in an existing pane shell.

Source and package
Qualified name
ShellCommandResult
Module
shell-command
Package
libtmux
Source
packages/libtmux/src/shell-command.ts
type shell-command.ShellCommandResult = ShellCommandEvidence & ( | { readonly exitStatus: number; readonly outcome: "completed" } | { readonly exitStatus: null; readonly outcome: "cancelled" | "pane_died" | "timed_out"; } )

Description

A completed result carries the exit status from the command's own frame. A timeout or cancellation can leave accepted input for the shell to run. Check outputComplete before using the output as a full transcript.

Examples

import type { ShellCommandResult } from "libtmux";
const session = await server.newSession({ shellCommand: "exec sh -i" });
try {
const result: ShellCommandResult = await session.panes.one().runCommand("printf ready");
if (result.outcome === "completed" && result.outputComplete) console.log(result.output);
} finally {
await session.kill();
}
Esc
Search in

Type to search.

Reference previewOpen reference