aplteam / Cider

Cider is a Project Manager for Dyalog APL
MIT License
10 stars 6 forks source link

AddNuGetDependencies with non-existent dependency throws DOMAIN ERROR on Linux #65

Open Alexander-Block opened 6 months ago

Alexander-Block commented 6 months ago

As codified in the test case Test_NuGet_002 the function AddNuGetDependencies is expected to print an error message to the session when given a non-existent package as dependency, not raise an actual error. This works without issues on Windows, however on Debian Bookworm I observed the following:

      Cider.TestCases.Prepare

Code coverage? (y/N) N
      #.Cider.TestCases.Test_NuGet_002 1 1
DOMAIN ERROR
Add[29] z←⍪r←⎕CMD 'dotnet add ',project_dir,' package ',add
                       ∧
        ↑⎕XSI,¨'[',¨(⍕¨⎕LC),¨']'
#._tatin.dyalog_NuGet_0_2_0.Add[28]   
#.Cider.Cider.AddNuGetDependencies[30]
#.Cider.TestCases.Test_NuGet_002[25] 
               add
DoesNotExist

The underlying reason is that ⎕CMD works slightly differently on Windows and on Linux. On Windows it always returns the CMD output, while on Linux it raises a DOMAIN ERROR whenever the command processed has a return code that is not equal to 0. This is the case whenever dotnet fails to add a package via a call to dotnet add.

For consistent behaviour across plattforms, this error mode should be captured and properly handled in AddNuGetDependencies.

aplteam commented 3 months ago

Strictly speaking this is not a Cider problem but a problem of the package dyalog-NuGet, and should (and will) be solved there.

I leave it open here until it's fixed because other issues refer to this one.