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

Fix crash on macOS and BSD with SpawnNewInstance action

This commit is contained in:
Carlos Tuñón 2019-01-19 08:45:45 -05:00 committed by Christian Duerr
parent 8b15596070
commit 09003f6c30
3 changed files with 143 additions and 317 deletions

View file

@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Prevent Alacritty from crashing when started on a system without any free space
- Resolve issue with high CPU usage after moving Alacritty between displays
- Characters will no longer be deleted when using ncurses with the hard tab optimization
- Crash on non-linux operating systems when using the `SpawnNewInstance` action
## Version 0.2.5

444
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -185,14 +185,17 @@ impl<'a, N: Notify + 'a> input::ActionContext for ActionContext<'a, N> {
fn spawn_new_instance(&mut self) {
let alacritty = env::args().next().unwrap();
#[cfg(unix)]
let args = [
"--working-directory".into(),
fs::read_link(format!("/proc/{}/cwd", unsafe { tty::PID }))
.expect("shell working directory"),
];
let args = {
if let Ok(path) = fs::read_link(format!("/proc/{}/cwd", unsafe { tty::PID })) {
vec!["--working-directory".into(), path]
} else {
Vec::new()
}
};
#[cfg(not(unix))]
let args: [&str; 0] = [];
let args: Vec<String> = Vec::new();
match start_daemon(&alacritty, &args) {
Ok(_) => debug!("Started new Alacritty process: {} {:?}", alacritty, args),