mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	When using tmux as a login shell, there is currently no way to specify a shell
to be used as a login shell inside tmux, so add a default-shell session option. This sets the shell invoked as a login shell when the default-command option is empty. The default option value is whichever of $SHELL, getpwuid(getuid())'s pw_shell or /bin/sh is valid first. Based on a diff from martynas@, changed by me to be a session option rather than a window option.
This commit is contained in:
		@@ -19,6 +19,7 @@
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
#include <sys/time.h>
 | 
			
		||||
 | 
			
		||||
#include <paths.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
@@ -207,6 +208,7 @@ session_new(struct session *s,
 | 
			
		||||
{
 | 
			
		||||
	struct window	*w;
 | 
			
		||||
	struct environ	 env;
 | 
			
		||||
	const char	*shell;
 | 
			
		||||
	u_int		 hlimit;
 | 
			
		||||
 | 
			
		||||
	environ_init(&env);
 | 
			
		||||
@@ -214,9 +216,13 @@ session_new(struct session *s,
 | 
			
		||||
	environ_copy(&s->environ, &env);
 | 
			
		||||
	server_fill_environ(s, &env);
 | 
			
		||||
 | 
			
		||||
	shell = options_get_string(&s->options, "default-shell");
 | 
			
		||||
	if (*shell == '\0' || areshell(shell))
 | 
			
		||||
		shell = _PATH_BSHELL;
 | 
			
		||||
 | 
			
		||||
	hlimit = options_get_number(&s->options, "history-limit");
 | 
			
		||||
	w = window_create(
 | 
			
		||||
	    name, cmd, cwd, &env, &s->tio, s->sx, s->sy, hlimit, cause);
 | 
			
		||||
	    name, cmd, shell, cwd, &env, &s->tio, s->sx, s->sy, hlimit, cause);
 | 
			
		||||
	if (w == NULL) {
 | 
			
		||||
		environ_free(&env);
 | 
			
		||||
		return (NULL);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user