mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Set $TMUX without the session when background jobs are run.
This commit is contained in:
		
							
								
								
									
										18
									
								
								server-fn.c
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								server-fn.c
									
									
									
									
									
								
							@@ -30,14 +30,20 @@ void		server_callback_identify(int, short, void *);
 | 
			
		||||
void
 | 
			
		||||
server_fill_environ(struct session *s, struct environ *env)
 | 
			
		||||
{
 | 
			
		||||
	char	tmuxvar[MAXPATHLEN], *term;
 | 
			
		||||
	char	var[MAXPATHLEN], *term;
 | 
			
		||||
	u_int	idx;
 | 
			
		||||
	long	pid;
 | 
			
		||||
 | 
			
		||||
	xsnprintf(tmuxvar, sizeof tmuxvar,
 | 
			
		||||
	    "%s,%ld,%u", socket_path, (long) getpid(), s->idx);
 | 
			
		||||
	environ_set(env, "TMUX", tmuxvar);
 | 
			
		||||
	if (s != NULL) {
 | 
			
		||||
		term = options_get_string(&s->options, "default-terminal");
 | 
			
		||||
		environ_set(env, "TERM", term);
 | 
			
		||||
 | 
			
		||||
	term = options_get_string(&s->options, "default-terminal");
 | 
			
		||||
	environ_set(env, "TERM", term);
 | 
			
		||||
		idx = s->idx;
 | 
			
		||||
	} else
 | 
			
		||||
		idx = -1;
 | 
			
		||||
	pid = getpid();
 | 
			
		||||
	xsnprintf(var, sizeof var, "%s,%ld,%d", socket_path, pid, idx);
 | 
			
		||||
	environ_set(env, "TMUX", var);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user