# window.Window.respawn

- **Module:** window.Window
- **Package:** libtmux
- **Language:** Rust
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-rs/blob/f0e37052c232636b61d095817046e6bfc8f2ca40/crates/libtmux/src/window.rs#L559
- **Page:** https://libtmux.org/en/rs/latest/reference/window-window-respawn/

```
window.Window.respawn(mut, command: Option<impl Into<OsString>>, respawn_mode: Respawn) -> Result<&mut Self, Error>
```

Restart the window's command in place.

Passing `None` reruns whatever the window started with. Every pane in
the window is replaced by the one the command runs in, which is what
makes this different from respawning a pane: [`crate::Pane::respawn`]
restarts one pane and leaves its neighbours alone.

# Errors

Returns an error when a pane is still running and `kill` is not set.
