# Libtmux_eio.Terminal.attach_current

- **Module:** Libtmux_eio
- **Package:** libtmux-eio
- **Language:** OCaml
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-ocaml/blob/205dfda49742592b479247049d186956e4a4cfe9/eio/libtmux_eio.mli#L25
- **Public owner:** Libtmux_eio
- **Page:** https://libtmux.org/en/ocaml/latest/reference/libtmux_eio-terminal-attach_current/

```
val attach_current :
  ?cleanup:Cleanup.t ->
  ?binary:string ->
  ?read_only:bool ->
  ?update_environment:bool ->
  ?stdin:[> Eio.Flow.source_ty ] Eio.Flow.source ->
  ?stdout:[> Eio.Flow.sink_ty ] Eio.Flow.sink ->
  ?stderr:[> Eio.Flow.sink_ty ] Eio.Flow.sink ->
  process_mgr:[> [> `Generic ] Eio.Process.mgr_ty ] Eio.Process.mgr ->
  Libtmux.Endpoint.t ->
  session:Libtmux.Session.Id.t -> (unit, Libtmux.Error.t) result
```

Run an interactive terminal client until exit, using the application's process manager and standard streams unless explicit flows are supplied. `stdin` must be backed by a terminal descriptor; a pipe-backed flow is rejected by tmux. Select the exact ID on the daemon currently listening at `endpoint`, without a captured target, binding, retry or daemon startup.

Environment updates and read-only mode default to false. Clear inherited `TMUX` and `TMUX_PANE`. Cancellation propagates after terminating and reaping this client; it does not stop the daemon. Cooperative TERM gets 200 ms of grace before forced termination, while other fibers can run. Scheduling and kernel completion can add time. Success proves terminal client exit. Diagnostics go to `stderr`; borrowed flows stay open. Supply `cleanup` before the call to retain secondary failures after cancellation.

## Parameters

- `cleanup?` (`Cleanup.t`)
- `binary?` (`string`)
- `read_only?` (`bool`)
- `update_environment?` (`bool`)
- `stdin?` (`[> Eio.Flow.source_ty ] Eio.Flow.source`)
- `stdout?` (`[> Eio.Flow.sink_ty ] Eio.Flow.sink`)
- `stderr?` (`[> Eio.Flow.sink_ty ] Eio.Flow.sink`)
- `process_mgr` (``[> [> `Generic ] Eio.Process.mgr_ty ] Eio.Process.mgr``)
- `arg1` (`Libtmux.Endpoint.t`)
- `session` (`Libtmux.Session.Id.t`)
