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) {
4949 private static async Task < SuccessOrFailure > TryCreateGitTag ( string updatedVersion ) {
5050 var gitTagInfo = new ProcessStartInfo ( "git" , "tag v" + updatedVersion ) {
5151 RedirectStandardOutput = true ,
52+ RedirectStandardError = true , // Capture error messages
5253 UseShellExecute = false ,
5354 CreateNoWindow = true
5455 } ;
5556
5657 using Process ? gitTagProcess = Process . Start ( gitTagInfo ) ;
57- Console . WriteLine ( await gitTagProcess ? . StandardOutput . ReadToEndAsync ( ) ! ) ;
58- await gitTagProcess . WaitForExitAsync ( ) ;
5958
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+
6174 return new Success ( ) ;
6275
6376 }
77+
6478 private static async Task < SuccessOrFailure > TryCreateGitCommit ( string updatedVersion ) {
6579
6680 var gitCommitInfo = new ProcessStartInfo ( "git" , $ "commit -am \" VersionBump : v{ updatedVersion } \" ") {
You can’t perform that action at this time.
0 commit comments