Skip to content

Commit

Permalink
feat(common-utils): Stricten a check in resolveExecutable()
Browse files Browse the repository at this point in the history
On non-Windows, additionally check the that file is marked as executable.

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
  • Loading branch information
sschuberth committed Sep 27, 2024
1 parent baa1fd4 commit 6b896c3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion utils/common/src/main/kotlin/Os.kt
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,6 @@ object Os {
fun resolveExecutable(executable: File): File? {
val extensions = env["PATHEXT"]?.splitToSequence(File.pathSeparatorChar).orEmpty()
return extensions.map { File(executable.path + it.lowercase()) }.find { it.isFile }
?: executable.takeIf { it.isFile }
?: executable.takeIf { it.isFile && it.canExecute() }
}
}

0 comments on commit 6b896c3

Please sign in to comment.