Skip to content

Commit bd999e6

Browse files
committed
Add support for OpenHarmony platform
1 parent 65ded65 commit bd999e6

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎nvm.sh‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2253,6 +2253,14 @@ nvm_get_os() {
22532253
AIX\ *) NVM_OS=aix ;;
22542254
CYGWIN* | MSYS* | MINGW*) NVM_OS=win ;;
22552255
esac
2256+
# OpenHarmony cannot be reliably detected via `uname` because the device
2257+
# may run either a Linux kernel or a HarmonyOS kernel; detect it from the
2258+
# userland musl libc instead.
2259+
local MUSL_LIBC
2260+
MUSL_LIBC="/lib/ld-musl-aarch64.so.1"
2261+
if [ -f "${MUSL_LIBC}" ] && command strings "${MUSL_LIBC}" 2>/dev/null | command grep -q "OHOS"; then
2262+
NVM_OS=openharmony
2263+
fi
22562264
nvm_echo "${NVM_OS-}"
22572265
}
22582266

0 commit comments

Comments
 (0)