mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Add -E to detach-client to exec a command to replace the client instead
of exiting it, useful if tmux wasn't exec'd itself. From Jenna Magius.
This commit is contained in:
		@@ -296,6 +296,32 @@ server_client_detach(struct client *c, enum msgtype msgtype)
 | 
			
		||||
	proc_send_s(c->peer, msgtype, s->name);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Execute command to replace a client, */
 | 
			
		||||
void
 | 
			
		||||
server_client_exec(struct client *c, const char *cmd)
 | 
			
		||||
{
 | 
			
		||||
	struct session	*s = c->session;
 | 
			
		||||
	char		*msg, *shell;
 | 
			
		||||
	size_t		 cmdsize, shellsize;
 | 
			
		||||
 | 
			
		||||
	if (*cmd == '\0')
 | 
			
		||||
		return;
 | 
			
		||||
	cmdsize = strlen(cmd) + 1;
 | 
			
		||||
 | 
			
		||||
	if (s != NULL)
 | 
			
		||||
		shell = options_get_string(s->options, "default-shell");
 | 
			
		||||
	else
 | 
			
		||||
		shell = options_get_string(global_s_options, "default-shell");
 | 
			
		||||
	shellsize = strlen(shell) + 1;
 | 
			
		||||
 | 
			
		||||
	msg = xmalloc(cmdsize + shellsize);
 | 
			
		||||
	memcpy(msg, cmd, cmdsize);
 | 
			
		||||
	memcpy(msg + cmdsize, shell, shellsize);
 | 
			
		||||
 | 
			
		||||
	proc_send(c->peer, MSG_EXEC, -1, msg, cmdsize + shellsize);
 | 
			
		||||
	free(msg);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Check for mouse keys. */
 | 
			
		||||
static key_code
 | 
			
		||||
server_client_check_mouse(struct client *c)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user