提交 b1a053bb authored 作者: Radoslav Kirilov's avatar Radoslav Kirilov

fix(worker): cpu cores detection using sh and default to 4

In case bash is missing from the system the `cpu_cores.sh` fails with an
error and returns empty string resulting in command like
`make -j BUILDTYPE=Release -C out` that uses unlimited jobs and could
lead to signifficant CPU and RAM usage during build

The cpu_cores.sh is now changed to using `sh` instead of `bash`, so it
should be more portable. Additionally if the cpu detection fails the
jobs default to 4, that should be safe enough.
上级 d344eead
......@@ -6,7 +6,7 @@
# with gyp and Python3.
PYTHON ?= $(shell command -v python2 2> /dev/null || echo python)
ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
CORES ?= $(shell ${ROOT_DIR}/scripts/cpu_cores.sh)
CORES ?= $(shell ${ROOT_DIR}/scripts/cpu_cores.sh || echo 4)
MEDIASOUP_BUILDTYPE ?= Release
GULP = ../node_modules/.bin/gulp
LCOV = ./deps/lcov/bin/lcov
......
#!/usr/bin/env bash
#!/usr/bin/env sh
set -e
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论