Skip to content

Commit c6fc340

Browse files
committed
Warn about non-executable classpath scripts
1 parent 91a29b2 commit c6fc340

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ internal class ShellClassPathResolver(
3737
/** Create a shell resolver if a file is a pom. */
3838
fun maybeCreate(file: Path): ShellClassPathResolver? =
3939
file.takeIf { scriptNames.any { name -> scriptExtensions.any { file.endsWith("$name$it") } } }
40+
?.takeIf {
41+
val isExecutable = Files.isExecutable(it)
42+
if (!isExecutable) {
43+
LOG.warn("Found classpath script $it that is NOT executable and therefore cannot be used. Perhaps you'd want to chmod +x it?")
44+
}
45+
isExecutable
46+
}
4047
?.let { ShellClassPathResolver(it) }
4148

4249
/** The root directory for config files. */

0 commit comments

Comments
 (0)