# tmux.Session.KillWith

- **Module:** tmux.Session
- **Package:** github.com/libtmux/libtmux-go/tmux
- **Language:** Go
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-go/blob/5f808882015a975a65acc7f9da5b3ff0d5cbdc91/tmux/lifecycle_kill.go#L111
- **Page:** https://libtmux.org/reference/go/tmux-session-killwith/

```
tmux.Session.KillWith(ctx: context.Context, request: SessionKillRequest) -> error
```

KillWith applies one kill-session mode without refreshing the materialized receiver. The zero request destroys the receiver; AllExcept destroys every other session while preserving the receiver and its current window; ClearAlerts only clears alerts in windows linked to the receiver and leaves sessions, winlinks, panes, client attachments, and current-window selections unchanged. Destroying a session handles clients as [Session.Kill] describes and removes its winlinks; windows left without links and their panes are also destroyed. Group destroys the receiver's group and requires tmux 3.7; on older versions it follows [UnsupportedPolicy].

The three modes are mutually exclusive. Only stderr makes a completed command
a [CommandError]; nonzero exits without stderr are ignored. Transport errors
are delivery-ambiguous.
