From e47e22fd32f0e5487bf99bd194c039cc3515e727 Mon Sep 17 00:00:00 2001 From: "George L. Yermulnik" Date: Wed, 30 Oct 2024 22:38:42 +0200 Subject: [PATCH] fix(`common::get_cpu_num`): Do not identify WSL as K8S --- hooks/_common.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hooks/_common.sh b/hooks/_common.sh index 3c71f2b0f..8784fbd47 100644 --- a/hooks/_common.sh +++ b/hooks/_common.sh @@ -199,8 +199,11 @@ function common::get_cpu_num { local millicpu - if [[ -f /sys/fs/cgroup/cpu/cpu.cfs_quota_us ]]; then - # Inside K8s pod or DinD in K8s + if [[ + -f /sys/fs/cgroup/cpu/cpu.cfs_quota_us && + ! -f /proc/sys/fs/binfmt_misc/WSLInterop ]] \ + ; then + # Inside K8s pod or DinD in K8s (but not inside WSL) millicpu=$(< /sys/fs/cgroup/cpu/cpu.cfs_quota_us) if [[ $millicpu -eq -1 ]]; then