1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-11 13:51:01 -05:00

Launch a login shell by default on macOS

This commit is contained in:
Bjorn Neergaard 2018-12-03 15:26:59 -07:00 committed by Christian Duerr
parent ca9a259caa
commit 0d2f5b0f0f
2 changed files with 14 additions and 4 deletions

View file

@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- Fixed a bad type conversion which could cause underflow on a window resize - Fixed a bad type conversion which could cause underflow on a window resize
- Alacritty now spawns a login shell on macOS, as with Terminal.app and iTerm2
## Version 0.2.3 ## Version 0.2.3

View file

@ -221,9 +221,18 @@ pub fn new<T: ToWinsize>(
let (master, slave) = openpty(win.ws_row as _, win.ws_col as _); let (master, slave) = openpty(win.ws_row as _, win.ws_col as _);
let default_shell = &Shell::new(pw.shell); let default_shell = if cfg!(target_os = "macos") {
let shell = config.shell() let shell_name = pw.shell.rsplit('/').next().unwrap();
.unwrap_or(default_shell); let argv = vec![
String::from("-c"),
format!("exec -a -{} {}", shell_name, pw.shell),
];
Shell::new_with_args("/bin/bash", argv)
} else {
Shell::new(pw.shell)
};
let shell = config.shell().unwrap_or(&default_shell);
let initial_command = options.command().unwrap_or(shell); let initial_command = options.command().unwrap_or(shell);
@ -243,7 +252,7 @@ pub fn new<T: ToWinsize>(
// Setup shell environment // Setup shell environment
builder.env("LOGNAME", pw.name); builder.env("LOGNAME", pw.name);
builder.env("USER", pw.name); builder.env("USER", pw.name);
builder.env("SHELL", shell.program()); builder.env("SHELL", pw.shell);
builder.env("HOME", pw.dir); builder.env("HOME", pw.dir);
if let Some(window_id) = window_id { if let Some(window_id) = window_id {