# LibTmux::Attachment.spawn

- **Module:** LibTmux
- **Package:** LibTmux
- **Language:** Raku
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-raku/blob/0b5dd3d32e20f83a0069874e33eab0eb48f55962/lib/LibTmux/Attachment.rakumod#L55
- **Page:** https://libtmux.org/en/raku/latest/reference/libtmux-attachment-spawn/

```
method spawn(Endpoint:D :$endpoint!, Incarnation:D :$incarnation!,
             SessionId:D :$session!, IO::Handle:D :$terminal!,
             Positive:D :$timeout-ms = 10_000, Positive:D :$max-stderr-bytes = 64 * 1024,
             Bool:D :$read-only = False, Bool:D :$detach-others = False,
             Bool:D :$update-environment = False,
             Cancellation :$cancel = Cancellation --> LibTmux::Attachment:D)
```

Spawn a tmux client on a supplied terminal. This does not prove attachment.

Spawn a tmux client on a supplied terminal. This does not prove attachment.

## Parameters

- `$endpoint` (`Endpoint:D`)
- `$incarnation` (`Incarnation:D`)
- `$session` (`SessionId:D`)
- `$terminal` (`IO::Handle:D`)
- `$timeout-ms?` (`Positive:D`)
- `$max-stderr-bytes?` (`Positive:D`)
- `$read-only?` (`Bool:D`)
- `$detach-others?` (`Bool:D`)
- `$update-environment?` (`Bool:D`)
- `$cancel?` (`Cancellation`)

## tmux command

The tmux commands behind `spawn`.

- [`attach-session`](/en/tmux/latest/manual/attach-session/)
- [`list-sessions`](/en/tmux/latest/manual/list-sessions/)

## tmux C API

The C declarations in tmux that implement these commands.

- [`cmd_attach_session_entry`](/en/tmux/latest/reference/c-variable-cmd_attach_session_entry/) (attribute)
- [`cmd_attach_session_exec`](/en/tmux/latest/reference/c-function-cmd-attach-session-c-cmd_attach_session_exec/) (function)
- [`cmd_list_sessions_entry`](/en/tmux/latest/reference/c-variable-cmd_list_sessions_entry/) (attribute)
- [`cmd_list_sessions_exec`](/en/tmux/latest/reference/c-function-cmd-list-sessions-c-cmd_list_sessions_exec/) (function)
