# test.TestServer.shutdown

- **Module:** test.TestServer
- **Package:** libtmux
- **Language:** Rust
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-rs/blob/8a648c0894dfffc9303583f753b6c8ae01f2fe76/crates/libtmux/src/test.rs#L873
- **Page:** https://libtmux.org/reference/rs/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.

Cancelling this future before lifecycle ownership transfers leaves the
guard responsible for synchronous forced best-effort cleanup. Once this
future transfers ownership to its blocking waiter, that waiter completes
cleanup even if this future is cancelled; later cleanup failures are
unobservable to the cancelled caller.

## Example

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