Skip to content

Commit 73a7416

Browse files
committed
C#: Gracefully handle non-zero exitcodes for dotnet --info.
1 parent 446a437 commit 73a7416

File tree

2 files changed

+1
-22
lines changed
  • csharp/extractor

2 files changed

+1
-22
lines changed

csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DotNet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ private void Info()
4141
var res = dotnetCliInvoker.RunCommand("--info", silent: false);
4242
if (!res)
4343
{
44-
throw new Exception($"{dotnetCliInvoker.Exec} --info failed.");
44+
logger.LogError($"{dotnetCliInvoker.Exec} --info was terminated unexpectedly.");
4545
}
4646
}
4747

csharp/extractor/Semmle.Extraction.Tests/DotNet.cs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -79,27 +79,6 @@ public void TestDotnetInfo()
7979
Assert.Equal("--info", lastArgs);
8080
}
8181

82-
[Fact]
83-
public void TestDotnetInfoFailure()
84-
{
85-
// Setup
86-
var dotnetCliInvoker = new DotNetCliInvokerStub(new List<string>()) { Success = false };
87-
88-
// Execute
89-
try
90-
{
91-
_ = MakeDotnet(dotnetCliInvoker);
92-
}
93-
94-
// Verify
95-
catch (Exception e)
96-
{
97-
Assert.Equal("dotnet --info failed.", e.Message);
98-
return;
99-
}
100-
Assert.Fail("Expected exception");
101-
}
102-
10382
[Fact]
10483
public void TestDotnetRestoreProjectToDirectory1()
10584
{

0 commit comments

Comments
 (0)