[Perf] nvm_get_os: read /etc/os-release instead of forking uname -a

The file is read, not sourced. An `ID` with no OS of its own is only taken as Linux when the kernel's `ostype` says so; otherwise `uname -a` decides.
This commit is contained in:
Cassidy Marble authored and Jordan Harband committed 2026-10-06 14:23:02 -03:00
1 parent c28f2b70db
commit 1dd1d8c82e
4 files changed
+224 -11

No files matched your search

+4
View File
@@ -15,6 +15,10 @@ die () { cleanup; echo "$@" ; exit 1; }
MOCKS_DIR="$(pwd)/../../mocks"
export PATH=".:${PATH}"
# `nvm_get_os` reads `/etc/os-release` where it is available; this test drives
# the OS through the mocked `uname`, so point it at a file that does not exist
export NVM_OS_RELEASE="${MOCKS_DIR}/nonexistent-os-release"
# On Alpine (where /etc/alpine-release exists), both x64 and arm64 should get
# the -musl suffix, since unofficial-builds publishes musl binaries for both.
# On non-Alpine, neither should get -musl.