Closed SOberhoff closed 7 months ago
The issue has been fixed in the code. Please review the changes. Thanks!
I no longer get an error when the download is successful. But this still fails if the directory
~/.local/share/nvim/neotest-java
hasn't been created beforehand.
I'm unable to reproduce it. Can you share the error message, please?
Error while downloading:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0Warning: Failed to open the file
Warning: ~/.local/share/nvim/neotest-java/junit-platform-console-
Warning: standalone-1.10.1.jar: No such file or directory
0 2617k 0 16375 0 0 195k 0 0:00:13 --:--:-- 0:00:13 197k
curl: (23) Failure writing output to destination
Besides running :NeotestJava setup
this error can also be reproduced by running curl --output ~/.local/share/nvim/neotest-java/junit-platform-console-standalone-1.10.1.jar https://repo1.maven.org/maven2/org/junit/platform/junit-platform-console-standalone/1.10.1/junit-platform-console-standalone-1.10.1.jar
. I'm using curl 8.4.0. Adding the --create-dirs
flag overcomes this error.
I merged a new patch. This should prevent the issue in any environment.
Yeah, this does it.
https://github.com/rcasia/neotest-java/blob/9af20dbc445f568b5f6b6f3241f07259ee95cfe8/plugin/neotest-java.lua#L12-L30
First, if the directory neotest-java doesn't exist, curl won't create it and will instead raise an error.
Second, curl writes some information to stderr even if it completes successfully, causing this function to raise an error regardless.