# Server.wait(for:)

- **Module:** Server
- **Package:** libtmux-swift
- **Language:** Swift
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Sources/LibTmux/Wait.swift#L33
- **Page:** https://libtmux.org/en/swift/latest/reference/server-wait(for-)/

```
Server.wait(for:)(for: String) -> ()
```

Blocks until something signals `channel`.

Runs in a process of its own even on a connected server, because a
control client runs one command at a time: carried over the connection
this would hold back every call beside it, ``Server/signal(_:)``
included, and nothing would ever release it.

- Throws: ``TmuxError/serverRestarted`` if the server went away while
  this was waiting. tmux releases its waiters when it shuts down, with
  the same silent success a real signal produces, so the server's
  identity before and after is what tells a release from a departure.
  ``TmuxError/cancelled`` if the task was cancelled, which ends the
  wait without a signal.

## Raises

- `TmuxError`
