RFR: Fix skara update on Windows when CWD is not skara repository dir

Erik Helin ehelin at openjdk.java.net
Sat Oct 24 07:21:04 UTC 2020

On Fri, 23 Oct 2020 21:25:39 GMT, Christoph Langer <clanger at openjdk.org> wrote:

> On my windows client, I'm running in an issue when updating the skara tools. I see the following output/exception:
> Checking for updates ...
> Found the following updates:
> - forge: patch for commit can be null
> Rebuilding ...
> Exception in thread "main" java.io.IOException: Cannot run program "gradlew.bat" (in directory "C:\git\OpenJDK\skara"): CreateProcess error=2, The system cannot find the file specified
>         at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
>         at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
>         at org.openjdk.skara.cli/org.openjdk.skara.cli.GitSkara.update(GitSkara.java:176)
>         at org.openjdk.skara.cli/org.openjdk.skara.cli.GitSkara.main(GitSkara.java:230)
> Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
>         at java.base/java.lang.ProcessImpl.create(Native Method)
>         at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:483)
>         at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:158)
>         at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
>         ... 3 more
> The issue seems to be that only "gradlew.bat" is added as command to the gradle call (https://github.com/openjdk/skara/blob/master/cli/src/main/java/org/openjdk/skara/cli/GitSkara.java#L168). The process directory is set to the skara repository directory. However, "gradlew.bat" isn't resolved against the working directory by Processbuilder, but probably only against the current %PATH%.
> Currently, when running "git skara update" out of the skara repository path, it'll work.
> With the proposed tiny fix to resolve gradlew.bat before starting the Processbuilder it can be run from any working directory.

Looks good, thanks for fixing!


Marked as reviewed by ehelin (Reviewer).

PR: https://git.openjdk.java.net/skara/pull/916

More information about the skara-dev mailing list