[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
@@ -21,6 +21,10 @@ MOCKS_DIR="$(pwd)/../../mocks"
# binaries
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"
# Setups mock binaries for a given OS and arch that mimic
# the output of the real binaries used by nvm_get_arch to guess
# the architecture of a given system.