diff --git a/src/git.rs b/src/git.rs index 3709e79f..ae32044d 100644 --- a/src/git.rs +++ b/src/git.rs @@ -787,6 +787,7 @@ fn run_push(args: &[String], verbose: u8) -> Result<()> { if !stdout.trim().is_empty() { eprintln!("{}", stdout); } + std::process::exit(output.status.code().unwrap_or(1)); } Ok(()) @@ -872,6 +873,7 @@ fn run_pull(args: &[String], verbose: u8) -> Result<()> { if !stdout.trim().is_empty() { eprintln!("{}", stdout); } + std::process::exit(output.status.code().unwrap_or(1)); } Ok(()) @@ -1050,7 +1052,7 @@ fn run_fetch(args: &[String], verbose: u8) -> Result<()> { if !stderr.trim().is_empty() { eprintln!("{}", stderr); } - return Ok(()); + std::process::exit(output.status.code().unwrap_or(1)); } // Count new refs from stderr (git fetch outputs to stderr) @@ -1150,6 +1152,10 @@ fn run_stash(subcommand: Option<&str>, args: &[String], verbose: u8) -> Result<( &combined, &msg, ); + + if !output.status.success() { + std::process::exit(output.status.code().unwrap_or(1)); + } } _ => { // Default: git stash (push) @@ -1182,6 +1188,10 @@ fn run_stash(subcommand: Option<&str>, args: &[String], verbose: u8) -> Result<( }; timer.track("git stash", "rtk git stash", &combined, &msg); + + if !output.status.success() { + std::process::exit(output.status.code().unwrap_or(1)); + } } } @@ -1252,6 +1262,7 @@ fn run_worktree(args: &[String], verbose: u8) -> Result<()> { if !stderr.trim().is_empty() { eprintln!("{}", stderr); } + std::process::exit(output.status.code().unwrap_or(1)); } return Ok(()); }