# server.interactive.Server.command_prompt

- **Module:** server.interactive.Server
- **Package:** libtmux
- **Language:** Rust
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-rs/blob/8a648c0894dfffc9303583f753b6c8ae01f2fe76/crates/libtmux/src/server/interactive.rs#L103
- **Page:** https://libtmux.org/reference/rs/server-interactive-server-command_prompt/

```
server.interactive.Server.command_prompt(self, client: Option<&Client>, prompt: Option<&str>, command: impl Into<OsString>) -> Result<(), Error>
```

Open a command prompt on a client.

The prompt runs `command` once the user answers, with `%%` replaced by
what they typed.

This does not return when the prompt opens. tmux holds the invocation
until somebody answers or dismisses it, so a caller is waiting on a
person -- and on a server nobody is watching, on nobody. The dispatch
timeout is what ends that wait: with the default it fails after thirty
seconds having opened a prompt that is still there. Give the call a
server whose `default_timeout` suits a human, or drive it from a task
that may take that long.

Passing a client is not what decides this. Both forms wait; naming one
only decides which terminal the prompt appears on.

# Errors

Returns [`Error::ServerMismatch`] when the client belongs to another
server, or an error when no suitable client exists, when tmux refuses,
and when the dispatch timeout expires before the prompt is answered.
