Skip to content
Clone

fix(make): graceful shutdown - kill only background jobs

The previous trap 'kill 0' signalled the recipe shell's own process group, re-triggering the trap recursively and overflowing the stack (SIGSEGV core dump) on Ctrl-C. Kill only the background job PIDs instead. Also add the build-all target.
zhenyi committed
parent 510d47f commit f27e717 Browse files

1 file changed

+12 −1

Modified Makefile View Makefile
@@ -254,9 +254,20 @@
254254.PHONY: run
255255run: run-apihost
256256
257.PHONY: build-all
258build-all:
259 @trap 'kill $$(jobs -p) 2>/dev/null' INT TERM
260 cargo build -p apihost & \
261 cargo build -p githook & \
262 cargo build -p gitpro & \
263 cargo build -p livechat & \
264 cargo build -p mails & \
265 wait
266
267
257268.PHONY: run-all
258269run-all: port-check
259 @trap 'kill 0' SIGINT SIGTERM; \
270 @trap 'kill $$(jobs -p) 2>/dev/null' INT TERM; \
260271 cargo run -p apihost -- --port 8080 & \
261272 cargo run -p githook & \
262273 cargo run -p gitpro & \