mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-17 15:01:20 +02:00
* Makefile: build static binaries only * Replace bincover with go -cover from 1.20 * CI: Fix timing issue between lapi and agent containers
26 lines
666 B
Bash
Executable file
26 lines
666 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
is_crowdsec_running() {
|
|
# ignore processes in containers
|
|
PIDS=$(pgrep --ns $$ -x 'crowdsec|crowdsec.test')
|
|
}
|
|
|
|
# The process can be slow, especially on CI and during test coverage.
|
|
# Give it some time, maybe it's quitting soon.
|
|
for _i in {1..10}; do
|
|
is_crowdsec_running || exit 0
|
|
sleep .5
|
|
done
|
|
|
|
PIDS=$(echo "${PIDS}" | tr '\n' ' ')
|
|
msg="CrowdSec is already running (PID ${PIDS}). Please terminate it and run the tests again."
|
|
|
|
# Are we inside a setup() or @test? Is file descriptor 3 open?
|
|
if { true >&3; } 2>/dev/null; then
|
|
echo "${msg}" >&3
|
|
else
|
|
echo "${msg}" >&2
|
|
fi
|
|
|
|
# cause the calling setup() or @test to fail
|
|
exit 1
|