File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -199,7 +199,8 @@ function common::get_cpu_num {
199
199
200
200
local millicpu
201
201
202
- if [[ -f /sys/fs/cgroup/cpu/cpu.cfs_quota_us ]]; then
202
+ if [[ -f /sys/fs/cgroup/cpu/cpu.cfs_quota_us &&
203
+ ! -f /proc/sys/fs/binfmt_misc/WSLInterop ]]; then # WSL have cfs_quota_us, but WSL should be checked as usual Linux host
203
204
# Inside K8s pod or DinD in K8s
204
205
millicpu=$( < /sys/fs/cgroup/cpu/cpu.cfs_quota_us)
205
206
@@ -251,7 +252,7 @@ function common::get_cpu_num {
251
252
fi
252
253
253
254
# On host machine or any other case
254
- # `nproc` - Linux/FreeBSD, `sysctl -n hw.ncpu` - macOS/BSD, `echo 1` - fallback
255
+ # `nproc` - Linux/FreeBSD/WSL , `sysctl -n hw.ncpu` - macOS/BSD, `echo 1` - fallback
255
256
nproc 2> /dev/null || sysctl -n hw.ncpu 2> /dev/null || echo 1
256
257
}
257
258
You can’t perform that action at this time.
0 commit comments