diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2010-08-02 06:11:15 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2010-08-02 06:11:15 -0700 |
commit | e74e07e8b9f85816ec34b4e00b8b7925dcec5318 (patch) | |
tree | ce843919fe96fcca1488d91a11ebb5d2d345fb34 /src | |
parent | 0837462f33bbd85f2da1abd33b9650e540983f97 (diff) | |
download | DotNetOpenAuth-e74e07e8b9f85816ec34b4e00b8b7925dcec5318.zip DotNetOpenAuth-e74e07e8b9f85816ec34b4e00b8b7925dcec5318.tar.gz DotNetOpenAuth-e74e07e8b9f85816ec34b4e00b8b7925dcec5318.tar.bz2 |
Fixed NullReferenceException generated from latest git.exe under TeamCity.
Diffstat (limited to 'src')
-rw-r--r-- | src/DotNetOpenAuth.BuildTasks/GetBuildVersion.cs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/DotNetOpenAuth.BuildTasks/GetBuildVersion.cs b/src/DotNetOpenAuth.BuildTasks/GetBuildVersion.cs index dfb3468..9818885 100644 --- a/src/DotNetOpenAuth.BuildTasks/GetBuildVersion.cs +++ b/src/DotNetOpenAuth.BuildTasks/GetBuildVersion.cs @@ -72,12 +72,13 @@ namespace DotNetOpenAuth.BuildTasks { // First try asking Git for the HEAD commit id try { string cmdPath = Path.Combine(System.Environment.GetFolderPath(Environment.SpecialFolder.System), "cmd.exe"); - ProcessStartInfo psi = new ProcessStartInfo(cmdPath, "/c git rev-parse HEAD"); - psi.WindowStyle = ProcessWindowStyle.Hidden; - psi.CreateNoWindow = true; - psi.RedirectStandardOutput = true; - psi.UseShellExecute = false; - Process git = Process.Start(psi); + var psi = new ProcessStartInfo(cmdPath, "/c git rev-parse HEAD") { + WindowStyle = ProcessWindowStyle.Hidden, + CreateNoWindow = true, + RedirectStandardOutput = true, + UseShellExecute = false + }; + var git = Process.Start(psi); commitId = git.StandardOutput.ReadLine(); git.WaitForExit(); if (git.ExitCode != 0) { @@ -115,6 +116,7 @@ namespace DotNetOpenAuth.BuildTasks { } catch (DirectoryNotFoundException) { } + commitId = commitId ?? String.Empty; // doubly-be sure it's not null, since in some error cases it can be. return commitId.Trim(); } |