Skip to content

Commit 040b977

Browse files
committed
fix(common::get_cpu_num): Do not identify WSL as K8S
1 parent 89f4561 commit 040b977

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

hooks/_common.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,9 @@ function common::get_cpu_num {
199199

200200
local millicpu
201201

202-
if [[ -f /sys/fs/cgroup/cpu/cpu.cfs_quota_us ]]; then
203-
# Inside K8s pod or DinD in K8s
202+
if [[ -f /sys/fs/cgroup/cpu/cpu.cfs_quota_us &&
203+
! -f /proc/sys/fs/binfmt_misc/WSLInterop ]]; then
204+
# Inside K8s pod or DinD in K8s (but not inside WSL)
204205
millicpu=$(< /sys/fs/cgroup/cpu/cpu.cfs_quota_us)
205206

206207
if [[ $millicpu -eq -1 ]]; then

0 commit comments

Comments
 (0)