Skip to content

Commit

Permalink
Ensure console color gets set back properly
Browse files Browse the repository at this point in the history
Can't just assume that the foreground color should be black when we're done printing an error.
If you've got a terminal with a black background, you're in for a bad time.
  • Loading branch information
rubberduck203 committed Jul 9, 2017
1 parent 2236f44 commit b7f3da1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/gitnstats/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,15 @@ private static int RunAnalysis(string repositoryPath, string branchName)

private static void WriteError(string message)
{
var currentColor = Console.ForegroundColor;
Console.ForegroundColor = ConsoleColor.Red;
try
{
Console.Error.WriteLine(message);
}
finally
{
Console.ForegroundColor = ConsoleColor.Black;
Console.ForegroundColor = currentColor;
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/gitnstats/gitnstats.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
<Version>1.0.1</Version>
<RootNamespace>GitNStats</RootNamespace>
<RuntimeIdentifiers>
<RuntimeIdentifier>osx.10.12-x64</RuntimeIdentifier>
Expand Down

0 comments on commit b7f3da1

Please sign in to comment.