# window.Window.respawn

- **Module:** window
- **Package:** libtmux
- **Language:** TypeScript
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-ts/blob/073b9d7dedad900bff6f5ec0ea47794e40225870/packages/libtmux/src/window.ts#L371
- **Page:** https://libtmux.org/en/ts/latest/reference/window-window-respawn/

```
respawn(
  command?: string,
  options?: RespawnOptions,
): Promise<void>
```

Restart the command running in this window's active pane.

tmux refuses a window that is still running something unless [`kill`](/en/ts/latest/reference/window-window-kill/) says
to replace it.

## Examples

```ts
await window.respawn("sh", { kill: true });
```

## Parameters

- `command?` (`string`)
- `options?` (`RespawnOptions`)

## tmux command

The tmux commands behind `respawn`.

- [`respawn-window`](/en/tmux/latest/manual/respawn-window/)

## tmux C API

The C declarations in tmux that implement these commands.

- [`cmd_respawn_window_entry`](/en/tmux/latest/reference/c-variable-cmd_respawn_window_entry/) (attribute)
- [`cmd_respawn_window_exec`](/en/tmux/latest/reference/c-function-cmd-respawn-window-c-cmd_respawn_window_exec/) (function)

## In other ports

Restart the command in a window's active pane

| Language | Equivalent |
| --- | --- |
| Python | [`libtmux.Window.respawn`](/en/py/latest/reference/libtmux-window-respawn/) (method) |
| Ruby | [`LibTmux::Window#respawn`](/en/ruby/latest/reference/libtmux-window-respawn/) (method) |
| Lua | [`libtmux.Window:respawn`](/en/lua/latest/reference/libtmux-window-respawn/) (method) |
| Rust | [`window.Window.respawn`](/en/rs/latest/reference/window-window-respawn/) (method) |
| Go | [`tmux.Window.Respawn`](/en/go/latest/reference/tmux-window-respawn/) (method) |
| Java | [`io.github.libtmux.Window.respawn`](/en/java/latest/reference/io-github-libtmux-window-window-respawn/) (method) |
| C# | [`LibTmux.Window.RespawnAsync`](/en/csharp/latest/reference/libtmux-window-respawnasync/) (method) |
| C++ | no equivalent on `Window` |
| Swift | no equivalent on `Window` |

No equivalent is recorded in PowerShell, Julia, Elixir, Kotlin, Scala or F#.
