mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Set exittype for error exit as well as the error string.
This commit is contained in:
		
							
								
								
									
										10
									
								
								client.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								client.c
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
/* $Id: client.c,v 1.66 2009-08-19 09:00:05 nicm Exp $ */
 | 
			
		||||
/* $OpenBSD: client.c,v 1.15 2009/09/02 20:00:10 nicm Exp $ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
			
		||||
@@ -205,7 +205,7 @@ client_main(struct client_ctx *cctx)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
 	if (sigterm) {
 | 
			
		||||
 		printf("[terminated]\n");
 | 
			
		||||
 		return (1);
 | 
			
		||||
@@ -223,9 +223,12 @@ client_main(struct client_ctx *cctx)
 | 
			
		||||
	case CCTX_DETACH:
 | 
			
		||||
		printf("[detached]\n");
 | 
			
		||||
		return (0);
 | 
			
		||||
	default:
 | 
			
		||||
	case CCTX_ERROR:
 | 
			
		||||
		printf("[error: %s]\n", cctx->errstr);
 | 
			
		||||
		return (1);
 | 
			
		||||
	default:
 | 
			
		||||
		printf("[error: unknown error]\n");
 | 
			
		||||
		return (1);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -279,6 +282,7 @@ client_msg_dispatch(struct client_ctx *cctx)
 | 
			
		||||
 | 
			
		||||
			printdata.msg[(sizeof printdata.msg) - 1] = '\0';
 | 
			
		||||
			cctx->errstr = xstrdup(printdata.msg);
 | 
			
		||||
			cctx->exittype = CCTX_ERROR;
 | 
			
		||||
			imsg_free(&imsg);
 | 
			
		||||
			return (-1);
 | 
			
		||||
		case MSG_EXIT:
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										3
									
								
								tmux.h
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								tmux.h
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
/* $Id: tmux.h,v 1.431 2009-09-02 01:02:44 tcunha Exp $ */
 | 
			
		||||
/* $Id: tmux.h,v 1.432 2009-09-02 20:01:22 nicm Exp $ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
			
		||||
@@ -971,6 +971,7 @@ struct client_ctx {
 | 
			
		||||
		CCTX_EXIT,
 | 
			
		||||
		CCTX_DIED,
 | 
			
		||||
		CCTX_SHUTDOWN,
 | 
			
		||||
		CCTX_ERROR
 | 
			
		||||
	} exittype;
 | 
			
		||||
	const char	*errstr;
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user