Skip to content

Commit 98aee09

Browse files
committed
Update VersionBumpAtlas.cs
1 parent d9e4c94 commit 98aee09

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

src/CodeOfChaos.CliArgsParser.Library/CommandAtlases/VersionBumpAtlas.cs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff 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}\"") {

0 commit comments

Comments
 (0)