Handle null commit sha
- Apparently the .version file doesn't always end up in the package #1498
This commit is contained in:
parent
be8cde81b2
commit
39b0880dbe
1 changed files with 3 additions and 3 deletions
|
@ -135,11 +135,11 @@ namespace Microsoft.DotNet.Cli
|
||||||
{
|
{
|
||||||
HelpCommand.PrintVersionHeader();
|
HelpCommand.PrintVersionHeader();
|
||||||
|
|
||||||
var commitSha = GetCommitSha();
|
var commitSha = GetCommitSha() ?? "N/A";
|
||||||
Reporter.Output.WriteLine();
|
Reporter.Output.WriteLine();
|
||||||
Reporter.Output.WriteLine("Product Information:");
|
Reporter.Output.WriteLine("Product Information:");
|
||||||
Reporter.Output.WriteLine($" Version: {HelpCommand.ProductVersion}");
|
Reporter.Output.WriteLine($" Version: {HelpCommand.ProductVersion}");
|
||||||
Reporter.Output.WriteLine($" Commit Sha: {commitSha.Substring(0, 10)}");
|
Reporter.Output.WriteLine($" Commit Sha: {commitSha}");
|
||||||
Reporter.Output.WriteLine();
|
Reporter.Output.WriteLine();
|
||||||
var runtimeEnvironment = PlatformServices.Default.Runtime;
|
var runtimeEnvironment = PlatformServices.Default.Runtime;
|
||||||
Reporter.Output.WriteLine("Runtime Environment:");
|
Reporter.Output.WriteLine("Runtime Environment:");
|
||||||
|
@ -166,7 +166,7 @@ namespace Microsoft.DotNet.Cli
|
||||||
|
|
||||||
if (File.Exists(versionFile))
|
if (File.Exists(versionFile))
|
||||||
{
|
{
|
||||||
return File.ReadLines(versionFile).FirstOrDefault();
|
return File.ReadLines(versionFile).FirstOrDefault()?.Substring(0, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue