# test.TestServer.shutdown

- **Module:** test.TestServer
- **Package:** libtmux
- **Language:** Rust
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-rs/blob/f0e37052c232636b61d095817046e6bfc8f2ca40/crates/libtmux/src/test.rs#L902
- **Page:** https://libtmux.org/en/rs/latest/reference/test-testserver-shutdown/

```
test.TestServer.shutdown(mut) -> Result<(), TestServerError>
```

Stop the client executor and consume the daemon guard.

# Errors

Returns `ShutdownFailed` when executor closure, lifecycle
signaling/waiting, or the blocking waiter fails. Returns `CleanupFailed`
when descriptor-relative cleanup cannot be proved after lifecycle
processing.

This consumes the guard, closes its shared no-start executor, and then
terminates the retained foreground daemon. Escaped [`Server`] clones
cannot issue later commands.

# Cancel safety

Nothing is left behind, on a best-effort basis: dropped early, the
guard's own forced cleanup runs; dropped once cleanup has started, a
blocking task finishes it. Either way a failure goes unreported.

## Example

```rust
let guard = libtmux::test::TestServer::new().await?;
guard.shutdown().await?;
```
