Skip to content

Commit 1090fc1

Browse files
committed
cache musl version
1 parent fce4f2f commit 1090fc1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/runtime_musl_workaround.jl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,17 +127,21 @@ function get_musl_dso_type(musl_version::VersionNumber)
127127
end
128128
end
129129

130+
_musl_version = Ref{Union{Nothing,VersionNumber}}(nothing)
130131
function get_musl_version()
132+
if _musl_version[] !== nothing
133+
return _musl_version[]
134+
end
135+
131136
stderr = IOBuffer()
132137
run(pipeline(ignorestatus(`/lib/libc.musl-x86_64.so.1 --version`); stdout=Base.devnull, stderr))
133138

134-
version = nothing
135139
for line in split(String(take!(stderr)), "\n")
136140
if startswith(line, "Version ")
137-
version = parse(VersionNumber, line[9:end])
141+
_musl_version[] = parse(VersionNumber, line[9:end])
138142
end
139143
end
140-
return version
144+
return _musl_version[]
141145
end
142146

143147
function parse_soname(dso::musl_dso)

0 commit comments

Comments
 (0)