# shell-command.ShellCommandResult

- **Module:** shell-command
- **Package:** libtmux
- **Language:** TypeScript
- **Kind:** typealias
- **Source:** https://github.com/libtmux/libtmux-ts/blob/de36ea54f5c4b7c206870b2cb08b6f144bc5d55f/packages/libtmux/src/shell-command.ts#L88
- **Page:** https://libtmux.org/en/ts/latest/reference/shell-command-shellcommandresult/

```ts
type ShellCommandResult = ShellCommandEvidence &
(
  | { readonly exitStatus: number; readonly outcome: "completed" }
  | {
      readonly exitStatus: null;
      readonly outcome: "cancelled" | "pane_died" | "timed_out";
    }
)
```

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

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`](/en/ts/latest/reference/shell-command-shellcommandevidence-outputcomplete/) before using the output as a full transcript.

## Examples

```ts
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();
}
```
