mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Add a helper function to open the terminal for attach-/new-session.
This commit is contained in:
		@@ -43,7 +43,7 @@ cmd_attach_session_exec(struct cmd *self, struct cmd_ctx *ctx)
 | 
			
		||||
	struct session	*s;
 | 
			
		||||
	struct client	*c;
 | 
			
		||||
	const char	*update;
 | 
			
		||||
	char		*overrides, *cause;
 | 
			
		||||
	char		*cause;
 | 
			
		||||
	u_int		 i;
 | 
			
		||||
 | 
			
		||||
	if (RB_EMPTY(&sessions)) {
 | 
			
		||||
@@ -79,15 +79,8 @@ cmd_attach_session_exec(struct cmd *self, struct cmd_ctx *ctx)
 | 
			
		||||
		server_redraw_client(ctx->curclient);
 | 
			
		||||
		s->curw->flags &= ~WINLINK_ALERTFLAGS;
 | 
			
		||||
	} else {
 | 
			
		||||
		if (!(ctx->cmdclient->flags & CLIENT_TERMINAL)) {
 | 
			
		||||
			ctx->error(ctx, "not a terminal");
 | 
			
		||||
			return (-1);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		overrides =
 | 
			
		||||
		    options_get_string(&s->options, "terminal-overrides");
 | 
			
		||||
		if (tty_open(&ctx->cmdclient->tty, overrides, &cause) != 0) {
 | 
			
		||||
			ctx->error(ctx, "terminal open failed: %s", cause);
 | 
			
		||||
		if (server_client_open(ctx->cmdclient, s, &cause) != 0) {
 | 
			
		||||
			ctx->error(ctx, "open terminal failed: %s", cause);
 | 
			
		||||
			xfree(cause);
 | 
			
		||||
			return (-1);
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user