Skip to content

Commit a640909

Browse files
committed
✨ Added print statement in main.rs and refactored commands.rs to format both stdout and stderr.
1 parent 2fec1dd commit a640909

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/commands.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,9 @@ impl Commands {
2424

2525
let output = cmd.output().expect("Failed to execute command");
2626
// Convert the output bytes to a String and print it
27-
if output.status.success() {
28-
let stdout: String = String::from_utf8(output.stdout).unwrap();
29-
stdout
30-
} else {
31-
let stderr = String::from_utf8(output.stderr).unwrap();
32-
stderr
33-
}
27+
let stdout: String = String::from_utf8(output.stdout).unwrap();
28+
let stderr = String::from_utf8(output.stderr).unwrap();
29+
format!("{}\n{}", stdout, stderr)
3430
}
3531

3632
#[allow(dead_code)]

src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ fn push() {
115115
vec!["push".to_string(), "--force-with-lease".to_string()],
116116
);
117117
let output:String = git_push.call();
118+
println!("Push {}", output);
118119
}
119120

120121
fn parse_git_status(output: &str) -> (String, Vec<String>, Vec<String>) {

0 commit comments

Comments
 (0)