haskell / cabal

Official upstream development repository for Cabal and cabal-install
https://haskell.org/cabal
Other
1.6k stars 689 forks source link

Provide .bat alternatives to test scripts #10179

Open jasagredo opened 1 month ago

jasagredo commented 1 month ago

Some of the tests in our test-suite rely on external scripts that are written in bash, and although MSYS2 comes with bash, they are not understood directly by Windows. For this reason some tests are marked as broken.

It would be good to provide .bat alternatives to these scripts (which are easy scripts, it should't be too difficult) or alternatively combine the sh and batch scripts (with some magic https://stackoverflow.com/questions/17510688/single-script-to-run-in-both-windows-batch-and-linux-bash) so that those tests are also runnable on Windows.

jasagredo commented 1 month ago

Bat files are not a replacement for a real program on Windows, because we use Process.proc, which cannot call .bat files. See https://github.com/haskell/process/issues/140

I think the wisest thing would be to distinguish by extension if we should call proc or shell on Windows.

geekosaur commented 1 month ago

The other alternative is to use proc with the executable being cmd.exe and the batch file being the first parameter, I think.

jasagredo commented 1 month ago

I think then the arguments have to be inside the same string as the script such as cmd.exe /c "script.bat arg1 arg2" and not as cmd.exe /c "script.bat" "arg1" "arg2".

jasagredo commented 1 month ago

Test failing because of this issue: