Skip to content

Commit cfd1717

Browse files
authored
Check if gradlew is executable
There are rare instances, where there is a non-executable "gradlew" next to a build script. In this case the language server will crash when trying to execute "gradlew". The happens for example when using an openapi generator as this will place a "build.gradle" and a non-executable "gradlew" in the "build/generated" directory as helper files.
1 parent 78522d5 commit cfd1717

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

shared/src/main/kotlin/org/javacs/kt/classpath/GradleClassPathResolver.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ private fun gradleScriptToTempFile(scriptName: String, deleteOnExit: Boolean = f
6161
private fun getGradleCommand(workspace: Path): Path {
6262
val wrapperName = if (isOSWindows()) "gradlew.bat" else "gradlew"
6363
val wrapper = workspace.resolve(wrapperName).toAbsolutePath()
64-
if (Files.exists(wrapper)) {
64+
if (Files.isExecutable(wrapper)) {
6565
return wrapper
6666
} else {
6767
return workspace.parent?.let(::getGradleCommand)

0 commit comments

Comments
 (0)