# LibTmux::Server#attach

- **Module:** LibTmux
- **Package:** libtmux
- **Language:** Ruby
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-ruby/blob/c8b839595d5a30e271e3f9be0d0fe811ddb11b7e/gems/libtmux/lib/libtmux/terminal.rb#L47
- **Page:** https://libtmux.org/en/ruby/v0.1.0/reference/libtmux-server-attach/

tmux command: [`attach-session`](/en/tmux/latest/manual/attach-session/)

```
def attach: (
  session: ::LibTmux::EntityRef,
  terminal: ::IO,
  term: ::String,
  ?read_only: bool,
  ?timeout: ::Numeric?,
  ?cancel: untyped
) -> ::LibTmux::TerminalResult
```

Blocks until the owned interactive client exits. The caller supplies and
retains its TTY. Cancellation detaches this client, not pane commands.

Behavior contract: Terminal attachment.

## Parameters

- `session` (`::LibTmux::EntityRef`)
- `terminal` (`::IO`)
- `term` (`::String`)
- `read_only` (`bool`)
- `timeout` (`::Numeric?`)
- `cancel` (`untyped`)

## Raises

- `ArgumentError`
