inner tmux errors are now hidden

This commit is contained in:
Valerie Wolfe 2024-07-06 21:10:39 -04:00
parent 1acc7aeb7b
commit cdc68986fa
4 changed files with 10 additions and 7 deletions

View file

@ -1,6 +1,6 @@
[package] [package]
name = "remux" name = "remux"
version = "0.3.4" version = "0.3.5"
edition = "2021" edition = "2021"
authors = [ "Valerie Wolfe <sleeplessval@gmail.com>" ] authors = [ "Valerie Wolfe <sleeplessval@gmail.com>" ]
description = "A friendly command shortener for tmux" description = "A friendly command shortener for tmux"

View file

@ -8,7 +8,7 @@ use tmux_interface::{
use crate::{ use crate::{
error, error,
state::State, state::State,
util util::{ self, NULL }
}; };
pub fn path(state: &mut State) { pub fn path(state: &mut State) {
@ -48,7 +48,7 @@ pub fn switch(state: &mut State) {
Tmux::new() Tmux::new()
.add_command(switch) .add_command(switch)
.output().ok(); .stderr(NULL).output().ok();
} }
pub fn title(state: State) { pub fn title(state: State) {

View file

@ -13,7 +13,7 @@ use crate::{
error, error,
flag, flag,
state::State, state::State,
util util::{ self, NULL }
}; };
pub fn attach(state: &mut State) { pub fn attach(state: &mut State) {
@ -51,7 +51,7 @@ pub fn attach(state: &mut State) {
// build dispatch // build dispatch
let mut tmux = Tmux::new().add_command(attach); let mut tmux = Tmux::new().add_command(attach);
if let Some(select_window) = select_window { tmux = tmux.add_command(select_window); } if let Some(select_window) = select_window { tmux = tmux.add_command(select_window); }
tmux.output().ok(); tmux.stderr(NULL).output().ok();
state.nest_deinit(); state.nest_deinit();
} }
@ -188,6 +188,6 @@ pub fn new(state: &mut State) {
tmux = tmux.add_command(auto_name); tmux = tmux.add_command(auto_name);
} }
tmux.output().ok(); tmux.stderr(NULL).output().ok();
} }

View file

@ -4,7 +4,7 @@ use std::{
}; };
use tmux_interface::{ use tmux_interface::{
Session, Tmux, Session, StdIO, Tmux,
commands, commands,
variables::session::SessionsCtl variables::session::SessionsCtl
@ -12,6 +12,8 @@ use tmux_interface::{
use crate::error; use crate::error;
pub const NULL: Option<StdIO> = Some(StdIO::Null);
pub fn session_name() -> Option<String> { pub fn session_name() -> Option<String> {
let message = commands::DisplayMessage::new().print().message("#{session_name}"); let message = commands::DisplayMessage::new().print().message("#{session_name}");
@ -37,6 +39,7 @@ pub fn session_exists<S: Into<String>>(target: S) -> bool {
let has_session = commands::HasSession::new() let has_session = commands::HasSession::new()
.target_session(target.into()); .target_session(target.into());
Tmux::new().add_command(has_session) Tmux::new().add_command(has_session)
.stderr(NULL)
.status() .status()
.unwrap() .unwrap()
.success() .success()