mirror of
https://github.com/tmate-io/tmate.git
synced 2025-08-17 00:51:36 +02:00
Do this in a better way - print messages when exiting with nonzero.
Also remove the login shell information from server-info, only the client should care about it.
This commit is contained in:
47
client.c
47
client.c
@ -216,32 +216,33 @@ out:
|
||||
* Print exit status message, unless running as a login shell where it
|
||||
* would either be pointless or irritating.
|
||||
*/
|
||||
if (!login_shell) {
|
||||
if (sigterm) {
|
||||
printf("[terminated]\n");
|
||||
return (1);
|
||||
}
|
||||
switch (cctx->exittype) {
|
||||
case CCTX_DIED:
|
||||
printf("[lost server]\n");
|
||||
return (0);
|
||||
case CCTX_SHUTDOWN:
|
||||
if (sigterm) {
|
||||
printf("[terminated]\n");
|
||||
return (1);
|
||||
}
|
||||
switch (cctx->exittype) {
|
||||
case CCTX_DIED:
|
||||
printf("[lost server]\n");
|
||||
return (0);
|
||||
case CCTX_SHUTDOWN:
|
||||
if (!login_shell)
|
||||
printf("[server exited]\n");
|
||||
return (0);
|
||||
case CCTX_EXIT:
|
||||
if (cctx->errstr != NULL) {
|
||||
printf("[error: %s]\n", cctx->errstr);
|
||||
return (1);
|
||||
}
|
||||
printf("[exited]\n");
|
||||
return (0);
|
||||
case CCTX_DETACH:
|
||||
printf("[detached]\n");
|
||||
return (0);
|
||||
default:
|
||||
printf("[unknown error]\n");
|
||||
return (0);
|
||||
case CCTX_EXIT:
|
||||
if (cctx->errstr != NULL) {
|
||||
printf("[error: %s]\n", cctx->errstr);
|
||||
return (1);
|
||||
}
|
||||
if (!login_shell)
|
||||
printf("[exited]\n");
|
||||
return (0);
|
||||
case CCTX_DETACH:
|
||||
if (!login_shell)
|
||||
printf("[detached]\n");
|
||||
return (0);
|
||||
default:
|
||||
printf("[unknown error]\n");
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user