mirror of
				https://github.com/tmux/tmux.git
				synced 2025-10-26 12:27:15 +00:00 
			
		
		
		
	Use default-shell not _PATH_BSHELL to spawn commands, pointed out by
Dennis G?nnewig and Thomas Adam.
This commit is contained in:
		
							
								
								
									
										17
									
								
								window.c
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								window.c
									
									
									
									
									
								
							| @@ -739,23 +739,24 @@ window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell, | |||||||
| 		clear_signals(1); | 		clear_signals(1); | ||||||
| 		log_close(); | 		log_close(); | ||||||
|  |  | ||||||
| 		if (*wp->cmd != '\0') { | 		setenv("SHELL", wp->shell, 1); | ||||||
| 			/* Set SHELL but only if it is currently not useful. */ | 		ptr = strrchr(wp->shell, '/'); | ||||||
| 			shell = getenv("SHELL"); |  | ||||||
| 			if (checkshell(shell)) |  | ||||||
| 				setenv("SHELL", wp->shell, 1); |  | ||||||
|  |  | ||||||
| 			execl(_PATH_BSHELL, "sh", "-c", wp->cmd, (char *) NULL); | 		if (*wp->cmd != '\0') { | ||||||
|  | 			/* Use the command. */ | ||||||
|  | 			if (ptr != NULL && *(ptr + 1) != '\0') | ||||||
|  | 				xasprintf(&argv0, "%s", ptr + 1); | ||||||
|  | 			else | ||||||
|  | 				xasprintf(&argv0, "%s", wp->shell); | ||||||
|  | 			execl(wp->shell, argv0, "-c", wp->cmd, (char *) NULL); | ||||||
| 			fatal("execl failed"); | 			fatal("execl failed"); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		/* No command; fork a login shell. */ | 		/* No command; fork a login shell. */ | ||||||
| 		ptr = strrchr(wp->shell, '/'); |  | ||||||
| 		if (ptr != NULL && *(ptr + 1) != '\0') | 		if (ptr != NULL && *(ptr + 1) != '\0') | ||||||
| 			xasprintf(&argv0, "-%s", ptr + 1); | 			xasprintf(&argv0, "-%s", ptr + 1); | ||||||
| 		else | 		else | ||||||
| 			xasprintf(&argv0, "-%s", wp->shell); | 			xasprintf(&argv0, "-%s", wp->shell); | ||||||
| 		setenv("SHELL", wp->shell, 1); |  | ||||||
| 		execl(wp->shell, argv0, (char *) NULL); | 		execl(wp->shell, argv0, (char *) NULL); | ||||||
| 		fatal("execl failed"); | 		fatal("execl failed"); | ||||||
| 	} | 	} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Nicholas Marriott
					Nicholas Marriott