1
0
mirror of https://github.com/tmux/tmux.git synced 2025-04-21 11:58:48 +00:00

Set exittype for error exit as well as the error string.

This commit is contained in:
Nicholas Marriott 2009-09-02 20:00:10 +00:00
parent 74c35c513e
commit 7a4bac82d7
2 changed files with 7 additions and 2 deletions

View File

@ -201,7 +201,7 @@ client_main(struct client_ctx *cctx)
} }
} }
} }
if (sigterm) { if (sigterm) {
printf("[terminated]\n"); printf("[terminated]\n");
return (1); return (1);
@ -219,9 +219,12 @@ client_main(struct client_ctx *cctx)
case CCTX_DETACH: case CCTX_DETACH:
printf("[detached]\n"); printf("[detached]\n");
return (0); return (0);
default: case CCTX_ERROR:
printf("[error: %s]\n", cctx->errstr); printf("[error: %s]\n", cctx->errstr);
return (1); return (1);
default:
printf("[error: unknown error]\n");
return (1);
} }
} }
@ -275,6 +278,7 @@ client_msg_dispatch(struct client_ctx *cctx)
printdata.msg[(sizeof printdata.msg) - 1] = '\0'; printdata.msg[(sizeof printdata.msg) - 1] = '\0';
cctx->errstr = xstrdup(printdata.msg); cctx->errstr = xstrdup(printdata.msg);
cctx->exittype = CCTX_ERROR;
imsg_free(&imsg); imsg_free(&imsg);
return (-1); return (-1);
case MSG_EXIT: case MSG_EXIT:

1
tmux.h
View File

@ -974,6 +974,7 @@ struct client_ctx {
CCTX_EXIT, CCTX_EXIT,
CCTX_DIED, CCTX_DIED,
CCTX_SHUTDOWN, CCTX_SHUTDOWN,
CCTX_ERROR
} exittype; } exittype;
const char *errstr; const char *errstr;
}; };