Better error messages for fork.

This commit is contained in:
Nicholas Marriott
2009-01-23 16:59:14 +00:00
parent 3f171917f6
commit 4d9af27b0b
12 changed files with 77 additions and 56 deletions

View File

@@ -1,4 +1,4 @@
/* $Id: cmd-respawn-window.c,v 1.12 2009-01-19 18:23:40 nicm Exp $ */
/* $Id: cmd-respawn-window.c,v 1.13 2009-01-23 16:59:14 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -50,7 +50,7 @@ cmd_respawn_window_exec(struct cmd *self, struct cmd_ctx *ctx)
struct window_pane *wp;
struct session *s;
const char *env[] = CHILD_ENVIRON;
char buf[256];
char buf[256], *cause;
u_int i;
if ((wl = cmd_find_window(ctx, data->target, &s)) == NULL)
@@ -77,8 +77,9 @@ cmd_respawn_window_exec(struct cmd *self, struct cmd_ctx *ctx)
window_destroy_panes(w);
TAILQ_INSERT_HEAD(&w->panes, wp, entry);
window_pane_resize(wp, w->sx, w->sy);
if (window_pane_spawn(wp, data->arg, NULL, env) != 0) {
ctx->error(ctx, "respawn failed: %s:%d", s->name, wl->idx);
if (window_pane_spawn(wp, data->arg, NULL, env, &cause) != 0) {
ctx->error(ctx, "respawn window failed: %s", cause);
xfree(cause);
return (-1);
}
screen_reinit(&wp->base);