Skip to content

Commit

Permalink
cache musl version
Browse files Browse the repository at this point in the history
  • Loading branch information
staticfloat committed Aug 19, 2021
1 parent fce4f2f commit 1090fc1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/runtime_musl_workaround.jl
Original file line number Diff line number Diff line change
Expand Up @@ -127,17 +127,21 @@ function get_musl_dso_type(musl_version::VersionNumber)
end
end

_musl_version = Ref{Union{Nothing,VersionNumber}}(nothing)
function get_musl_version()
if _musl_version[] !== nothing
return _musl_version[]
end

stderr = IOBuffer()
run(pipeline(ignorestatus(`/lib/libc.musl-x86_64.so.1 --version`); stdout=Base.devnull, stderr))

version = nothing
for line in split(String(take!(stderr)), "\n")
if startswith(line, "Version ")
version = parse(VersionNumber, line[9:end])
_musl_version[] = parse(VersionNumber, line[9:end])
end
end
return version
return _musl_version[]
end

function parse_soname(dso::musl_dso)
Expand Down

0 comments on commit 1090fc1

Please sign in to comment.