Some Programs won't stop using 'x'.
Hello,
some programs (redis-server or mailcatcher for example) wont stop after stopping them using 'x'. Quitting mprocs afterwards makes it hung indefinitely and I need to <C-c> to terminate it. Afterwards I need to kill the mentioned programs on my own.
I already tried the stop-Options SIGINT, SIGTERM, SIGKILL and hard-kill, but none of them worked like expected.
My current workaround is using SIGTERM, switching to the program and <C-c> it in mprocs.
A possible solution would by to add a stop-option (like mentioned in #84) to call another program (In my example it would be redis-cli shutdown)
Do you happen to be on Windows? I ran into the same problem with SIGINT (which my app needs).
When I check the mprocs.log, I spot the following:
WARN [mprocs::proc] SIGINT signal is ignored on Windows
I am on Linux, and 'x' works when shutting down redis-server.
I am having this problem on Windows, though not exactly like the OP, since when I use q to stop mprocs it shuts down cleanly. I have a few different processes that I run with mprocs:
- a tokio/axum web server
-
vite -
wrangler dev
When I use x to stop any of these processes, mprocs immediately shows that they are DOWN, but there is nothing additional written to the log output for each of these processes. It is clear that these processes are still running both from a ps run in another terminal, as well as because I can still make network requests to these servers. However, mprocs is not showing any log output from these programs once it thinks they are stopped.
So, to me it seems like mprocs just doesn't know how to stop processes on Windows at all? I haven't found an example of a process that it can stop.
I don't develop on Windows much. I checked, and indeed processes kept running after stopping them by pressing x. I'll try to fix it asap.
Turns out that when a command a spawned in the shell then only wrapping cmd.exe is being terminated and the inner process keeps running. I am thinking ti change that to terminate the whole process tree. I need to read up on how process trees work on Windows.
In windows it might be easier to use taskkill instead of manually killing the process and it's children, see: https://stackoverflow.com/questions/5901679/kill-process-tree-programmatically-in-c-sharp
Essentially it would be calling taskkill /pid {pid} /T /F
I have the same issue with docker compose. It takes some time to stop docker containers, so it would be nice if mprocs would wait for that process to actually stop before giving the "down" indicator.
The same thing is true with mprocs quit command. It prompts if you want to stop all processes and quit, but if I press "y" and then run docker ps I can see that my containers are all still running.
EDIT For anyone stumbling across this, the documentation is actually quite clear on this front. I just needed to pass stop option with send-keys:
Here is my mprocs.yaml for docker compose:
procs:
docker:
shell: "docker compose up"
stop:
send-keys: ["<C-c>"]