File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
src/CodeOfChaos.CliArgsParser.Library/CommandAtlases Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -49,18 +49,32 @@ public async Task VersionBumpCommand(VersionBumpParameters args) {
49
49
private static async Task < SuccessOrFailure > TryCreateGitTag ( string updatedVersion ) {
50
50
var gitTagInfo = new ProcessStartInfo ( "git" , "tag v" + updatedVersion ) {
51
51
RedirectStandardOutput = true ,
52
+ RedirectStandardError = true , // Capture error messages
52
53
UseShellExecute = false ,
53
54
CreateNoWindow = true
54
55
} ;
55
56
56
57
using Process ? gitTagProcess = Process . Start ( gitTagInfo ) ;
57
- Console . WriteLine ( await gitTagProcess ? . StandardOutput . ReadToEndAsync ( ) ! ) ;
58
- await gitTagProcess . WaitForExitAsync ( ) ;
59
58
60
- if ( gitTagProcess . ExitCode != 0 ) return "Git Tagging failed" ;
59
+ if ( gitTagProcess == null ) {
60
+ return "Failed to start the Git process." ;
61
+ }
62
+
63
+ // Read both output and error streams
64
+ string output = await gitTagProcess . StandardOutput . ReadToEndAsync ( ) ;
65
+ string error = await gitTagProcess . StandardError . ReadToEndAsync ( ) ;
66
+
67
+ // Ensure the process finishes
68
+ await gitTagProcess . WaitForExitAsync ( ) ;
69
+
70
+ if ( gitTagProcess . ExitCode != 0 ) {
71
+ return $ "Git Tagging failed: { error } { output } ";
72
+ }
73
+
61
74
return new Success ( ) ;
62
75
63
76
}
77
+
64
78
private static async Task < SuccessOrFailure > TryCreateGitCommit ( string updatedVersion ) {
65
79
66
80
var gitCommitInfo = new ProcessStartInfo ( "git" , $ "commit -am \" VersionBump : v{ updatedVersion } \" ") {
You can’t perform that action at this time.
0 commit comments