mirror of
https://github.com/tmux/tmux.git
synced 2025-01-13 03:48:51 +00:00
Don't return 1 unless there was actually a problem (signal/lost server) rather
than for all events (normal exit/detach/etc).
This commit is contained in:
parent
6609093625
commit
9f47c6083a
11
client.c
11
client.c
@ -37,6 +37,7 @@
|
||||
struct imsgbuf client_ibuf;
|
||||
struct event client_event;
|
||||
const char *client_exitmsg;
|
||||
int client_exitval;
|
||||
|
||||
void client_send_identify(int);
|
||||
void client_send_environ(void);
|
||||
@ -216,12 +217,9 @@ client_main(void)
|
||||
|
||||
out:
|
||||
/* Print the exit message, if any, and exit. */
|
||||
if (client_exitmsg != NULL) {
|
||||
if (!login_shell)
|
||||
if (client_exitmsg != NULL && !login_shell)
|
||||
printf("[%s]\n", client_exitmsg);
|
||||
exit(1);
|
||||
}
|
||||
exit(0);
|
||||
exit(client_exitval);
|
||||
}
|
||||
|
||||
void
|
||||
@ -232,6 +230,7 @@ client_signal(int sig, unused short events, unused void *data)
|
||||
switch (sig) {
|
||||
case SIGTERM:
|
||||
client_exitmsg = "terminated";
|
||||
client_exitval = 1;
|
||||
client_write_server(MSG_EXITING, NULL, 0);
|
||||
break;
|
||||
case SIGWINCH:
|
||||
@ -275,6 +274,7 @@ client_callback(unused int fd, short events, unused void *data)
|
||||
|
||||
lost_server:
|
||||
client_exitmsg = "lost server";
|
||||
client_exitval = 1;
|
||||
event_loopexit(NULL);
|
||||
}
|
||||
|
||||
@ -321,6 +321,7 @@ client_dispatch(void)
|
||||
|
||||
client_write_server(MSG_EXITING, NULL, 0);
|
||||
client_exitmsg = "server exited";
|
||||
client_exitval = 1;
|
||||
break;
|
||||
case MSG_SUSPEND:
|
||||
if (datalen != 0)
|
||||
|
Loading…
Reference in New Issue
Block a user