feat: Redirect stderr on kill-session commands

This commit is contained in:
lwad 2023-11-24 21:50:12 +00:00
parent b89b18ded3
commit 6980d07d8f

View file

@ -13,6 +13,7 @@ use std::{
};
use tmux_interface::{
AttachSession,
commands::tmux::StdIO,
HasSession,
KillSession,
ListClients,
@ -141,7 +142,7 @@ fn focus_project(projects : &BTreeMap<String,String>, project_name : Option<Stri
};
match std::env::var("TMUX") {
Ok(_) => Tmux::new().add_command(SwitchClient::new().target_session(&session_name)).add_command(KillSession::new().target_session("PROJECTS")).status().unwrap().success(),
Ok(_) => Tmux::new().add_command(SwitchClient::new().target_session(&session_name)).add_command(KillSession::new().target_session("PROJECTS")).stderr(Some(StdIO::Null)).status().unwrap().success(),
Err(_) => Tmux::with_command(AttachSession::new().target_session(&session_name)).status().unwrap().success(),
};
}
@ -185,7 +186,7 @@ fn main() {
set_projects(&project_file_path, &projects);
match mode {
Mode::Delete => Tmux::with_command(KillSession::new().target_session(old_session_name)).status().unwrap().success(),
Mode::Delete => Tmux::with_command(KillSession::new().target_session(old_session_name)).stderr(Some(StdIO::Null)).status().unwrap().success(),
_ => true,
};
}