Skip to content

Commit

Permalink
fix(common::get_cpu_num): Do not identify WSL as K8S
Browse files Browse the repository at this point in the history
  • Loading branch information
yermulnik committed Oct 30, 2024
1 parent 89f4561 commit e47e22f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions hooks/_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e47e22f

Please sign in to comment.