Skip to content

Commit 73a91e3

Browse files
committed
Merge pull request #222 from JakeGinnivan/DumpLogOnError
Quick fix to dump log to console when an error occurs
2 parents 5ba76d3 + 6184cb1 commit 73a91e3

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

GitVersionExe/Program.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ namespace GitVersion
55
using System.Diagnostics;
66
using System.IO;
77
using System.Linq;
8+
using System.Text;
89

910
class Program
1011
{
12+
static StringBuilder log = new StringBuilder();
1113
const string MsBuild = @"c:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe";
1214

1315
static void Main()
@@ -134,6 +136,11 @@ static void Main()
134136
{
135137
exitCode = 0;
136138
}
139+
else
140+
{
141+
// Dump log to console if we fail to complete successfully
142+
Console.Write(log.ToString());
143+
}
137144

138145
Environment.Exit(exitCode.Value);
139146
}
@@ -145,7 +152,10 @@ static IEnumerable<IBuildServer> GetApplicableBuildServers(Authentication authen
145152

146153
static void ConfigureLogging(Arguments arguments)
147154
{
148-
var writeActions = new List<Action<string>>();
155+
var writeActions = new List<Action<string>>
156+
{
157+
s => log.AppendLine(s)
158+
};
149159

150160
if (arguments.Output == OutputType.BuildServer)
151161
{

0 commit comments

Comments
 (0)