Skip to content

Commit b3ebdb8

Browse files
hadronomyCopilot
andauthored
refactor(install): call ldd once
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Pablo Hernández <17086478+hadronomy@users.noreply.github.com>
1 parent d13a375 commit b3ebdb8

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

packages/cli/install.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,16 @@ detect_libc() {
153153

154154
# Check ldd output for musl/glibc
155155
if command -v ldd &> /dev/null; then
156-
if ldd --version 2>&1 | grep -qi musl; then
156+
ldd_out="$(ldd --version 2>&1 || true)"
157+
if echo "$ldd_out" | grep -qi musl; then
157158
echo "musl"
158159
return
159160
fi
160-
if ldd --version 2>&1 | grep -qi 'gnu libc\|glibc'; then
161+
if echo "$ldd_out" | grep -qi 'gnu libc'; then
162+
echo "gnu"
163+
return
164+
fi
165+
if echo "$ldd_out" | grep -qi 'glibc'; then
161166
echo "gnu"
162167
return
163168
fi

0 commit comments

Comments
 (0)