Skip to content

Commit

Permalink
bugfix: Check is lib and /usr/sbin paths exists before listing
Browse files Browse the repository at this point in the history
  • Loading branch information
tgodzik committed Aug 16, 2024
1 parent 46b864b commit 09f99ad
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cli/src/main/scala/bloop/cli/util/OsLibc.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,15 @@ object OsLibc {
if (foundMusl)
Some(true)
else {
val inLib = os.list(os.Path("/lib")).map(_.last)
val libPath = os.Path("/lib")
val inLib = if (libPath.toIO.exists()) os.list(libPath).map(_.last) else Nil
if (inLib.exists(_.contains("-linux-gnu"))) Some(false)
else if (inLib.exists(name => name.contains("libc.musl-") || name.contains("ld-musl-")))
Some(true)
else {
val inUsrSbin = os.list(os.Path("/usr/sbin")).map(_.last)
val sbinPath = os.Path("/usr/sbin")
val inUsrSbin =
if (sbinPath.toIO.exists()) os.list(sbinPath).map(_.last) else Nil
if (inUsrSbin.exists(_.contains("glibc"))) Some(false)
else None
}
Expand Down

0 comments on commit 09f99ad

Please sign in to comment.