mirror of
https://github.com/tmux/tmux.git
synced 2025-01-12 03:08:46 +00:00
Remove panes from layout if spawning them fails, reported by Anthony J
Bentley.
This commit is contained in:
parent
05e7fbd60f
commit
5bd5c9c84e
@ -147,6 +147,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
goto error;
|
||||
}
|
||||
new_wp = window_add_pane(w, hlimit);
|
||||
layout_assign_pane(lc, new_wp);
|
||||
|
||||
path = NULL;
|
||||
if (cmdq->client != NULL && cmdq->client->session == NULL)
|
||||
@ -159,7 +160,6 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
if (window_pane_spawn(new_wp, argc, argv, path, shell, cwd, &env,
|
||||
s->tio, &cause) != 0)
|
||||
goto error;
|
||||
layout_assign_pane(lc, new_wp);
|
||||
|
||||
server_redraw_window(w);
|
||||
|
||||
@ -194,8 +194,10 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
|
||||
error:
|
||||
environ_free(&env);
|
||||
if (new_wp != NULL)
|
||||
if (new_wp != NULL) {
|
||||
layout_close_pane(new_wp);
|
||||
window_remove_pane(w, new_wp);
|
||||
}
|
||||
cmdq_error(cmdq, "create pane failed: %s", cause);
|
||||
free(cause);
|
||||
if (fd != -1)
|
||||
|
Loading…
Reference in New Issue
Block a user