Description
When we abruptly close a terminal window, all the processes spawned via bench start
remain running in the background which upon invoking bench start again gives "address already in use" error and fails to spawn.
Gitlab also faced this and they added another service which knows/monitors all the other spawned processes and allows users to stop the process (via a stop command (eg: bench stop
)) before trying to start the services again (ref: https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/runit.md?ref_type=heads#why-replace-foreman). Maybe we could try something similar?
ps aux | grep -e $(bench pwd) -e $(bench get-redis-ports)
and then killing those processes might do but feels very hacky.
Maybe if we keep the process pids somewhere we can then directly kill them when invoking bench stop
command?
Maybe we can add signal handler in honcho to handle SIGHUP? which will cause all processes to exit as soon as terminal is closed.
Any/all thoughts are welcome :)