don't try to use lsof on Windows (#2762)
This commit is contained in:
parent
c4bf4f8fff
commit
59b1a4772c
|
@ -187,12 +187,14 @@ mkdir -p "${NETWORK_DIR}"
|
||||||
|
|
||||||
USER_VALIDATORS=8
|
USER_VALIDATORS=8
|
||||||
TOTAL_VALIDATORS=128
|
TOTAL_VALIDATORS=128
|
||||||
|
HAVE_LSOF=0
|
||||||
|
|
||||||
# Windows detection
|
# Windows detection
|
||||||
if uname | grep -qiE "mingw|msys"; then
|
if uname | grep -qiE "mingw|msys"; then
|
||||||
MAKE="mingw32-make"
|
MAKE="mingw32-make"
|
||||||
else
|
else
|
||||||
MAKE="make"
|
MAKE="make"
|
||||||
|
which lsof &>/dev/null && HAVE_LSOF=1 || { echo "'lsof' not installed and we need it to check for ports already in use. Aborting."; exit 1; }
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# number of CPU cores
|
# number of CPU cores
|
||||||
|
@ -203,21 +205,22 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# kill lingering processes from a previous run
|
# kill lingering processes from a previous run
|
||||||
which lsof &>/dev/null || { echo "'lsof' not installed. Aborting."; exit 1; }
|
if [[ "${HAVE_LSOF}" == "1" ]]; then
|
||||||
for NUM_NODE in $(seq 0 $(( NUM_NODES - 1 ))); do
|
for NUM_NODE in $(seq 0 $(( NUM_NODES - 1 ))); do
|
||||||
for PORT in $(( BASE_PORT + NUM_NODE )) $(( BASE_METRICS_PORT + NUM_NODE )) $(( BASE_RPC_PORT + NUM_NODE )); do
|
for PORT in $(( BASE_PORT + NUM_NODE )) $(( BASE_METRICS_PORT + NUM_NODE )) $(( BASE_RPC_PORT + NUM_NODE )); do
|
||||||
for PID in $(lsof -n -i tcp:${PORT} -sTCP:LISTEN -t); do
|
for PID in $(lsof -n -i tcp:${PORT} -sTCP:LISTEN -t); do
|
||||||
echo -n "Found old process listening on port ${PORT}, with PID ${PID}. "
|
echo -n "Found old process listening on port ${PORT}, with PID ${PID}. "
|
||||||
if [[ "${KILL_OLD_PROCESSES}" == "1" ]]; then
|
if [[ "${KILL_OLD_PROCESSES}" == "1" ]]; then
|
||||||
echo "Killing it."
|
echo "Killing it."
|
||||||
kill -9 ${PID} || true
|
kill -9 ${PID} || true
|
||||||
else
|
else
|
||||||
echo "Aborting."
|
echo "Aborting."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
done
|
fi
|
||||||
|
|
||||||
# Build the binaries
|
# Build the binaries
|
||||||
BINARIES="nimbus_beacon_node nimbus_signing_process nimbus_validator_client deposit_contract"
|
BINARIES="nimbus_beacon_node nimbus_signing_process nimbus_validator_client deposit_contract"
|
||||||
|
|
|
@ -115,11 +115,14 @@ MKDIR_SCRIPT="${GIT_ROOT}/scripts/makedir.sh"
|
||||||
|
|
||||||
$MKDIR_SCRIPT "${TEST_DIR}"
|
$MKDIR_SCRIPT "${TEST_DIR}"
|
||||||
|
|
||||||
|
HAVE_LSOF=0
|
||||||
|
|
||||||
# Windows detection
|
# Windows detection
|
||||||
if uname | grep -qiE "mingw|msys"; then
|
if uname | grep -qiE "mingw|msys"; then
|
||||||
MAKE="mingw32-make"
|
MAKE="mingw32-make"
|
||||||
else
|
else
|
||||||
MAKE="make"
|
MAKE="make"
|
||||||
|
which lsof &>/dev/null && HAVE_LSOF=1 || { echo "'lsof' not installed and we need it to check for ports already in use. Aborting."; exit 1; }
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# number of CPU cores
|
# number of CPU cores
|
||||||
|
@ -130,19 +133,20 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# kill lingering processes from a previous run
|
# kill lingering processes from a previous run
|
||||||
which lsof &>/dev/null || { echo "'lsof' not installed. Aborting."; exit 1; }
|
if [[ "${HAVE_LSOF}" == "1" ]]; then
|
||||||
for PORT in ${BASE_PORT} ${BASE_METRICS_PORT} ${BASE_REST_PORT}; do
|
for PORT in ${BASE_PORT} ${BASE_METRICS_PORT} ${BASE_REST_PORT}; do
|
||||||
for PID in $(lsof -n -i tcp:${PORT} -sTCP:LISTEN -t); do
|
for PID in $(lsof -n -i tcp:${PORT} -sTCP:LISTEN -t); do
|
||||||
echo -n "Found old process listening on port ${PORT}, with PID ${PID}. "
|
echo -n "Found old process listening on port ${PORT}, with PID ${PID}. "
|
||||||
if [[ "${KILL_OLD_PROCESSES}" == "1" ]]; then
|
if [[ "${KILL_OLD_PROCESSES}" == "1" ]]; then
|
||||||
echo "Killing it."
|
echo "Killing it."
|
||||||
kill -9 ${PID} || true
|
kill -9 ${PID} || true
|
||||||
else
|
else
|
||||||
echo "Aborting."
|
echo "Aborting."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
done
|
done
|
||||||
done
|
fi
|
||||||
|
|
||||||
build_if_missing () {
|
build_if_missing () {
|
||||||
if [[ ! -e "${GIT_ROOT}/build/${1}" ]]; then
|
if [[ ! -e "${GIT_ROOT}/build/${1}" ]]; then
|
||||||
|
|
Loading…
Reference in New Issue