Skip to content

Commit f0e2953

Browse files
committed
cache musl version
1 parent fce4f2f commit f0e2953

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/runtime_musl_workaround.jl

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

130+
_musl_version = nothing
130131
function get_musl_version()
132+
if _musl_version !== nothing
133+
return _musl_version
134+
end
131135
stderr = IOBuffer()
132136
run(pipeline(ignorestatus(`/lib/libc.musl-x86_64.so.1 --version`); stdout=Base.devnull, stderr))
133137

134-
version = nothing
135138
for line in split(String(take!(stderr)), "\n")
136139
if startswith(line, "Version ")
137-
version = parse(VersionNumber, line[9:end])
140+
_musl_version = parse(VersionNumber, line[9:end])
138141
end
139142
end
140-
return version
143+
return _musl_version
141144
end
142145

143146
function parse_soname(dso::musl_dso)
@@ -186,7 +189,7 @@ function replace_musl_shortname(lib_handle::Ptr{Cvoid})
186189
end
187190
@debug("Auto-detected musl version", version=musl_version)
188191

189-
dso_type = get_musl_dso_type(musl_version)
192+
dso_type = get_musl_dso_type()
190193
if dso_type === nothing
191194
@debug("Unsupported musl ABI version", musl_version)
192195
return lib_handle

0 commit comments

Comments
 (0)