jarlah
Can mix tasks be gracefully shutdown?
Is there any way to handle task termination gracefully?
When i do ctrl-c no form for shutdown hook is called in the task. I have yet to see an example or google search hit for something that shows how this can be solved.
Is it a futile project and a dead end? Will mix tasks always be hard killed with no way to gracefully shutdown?
Marked As Solved
jarlah
Btw. It is solved. By not using System.cmd and instead running tasks via Mix.Task.run. When i ran the task via System.cmd the spawned task outlived the task it was spawned from.
Also Liked
arcanemachine
I started using Ctrl + \ a while back and I think it is more graceful than Ctrl + c.
benwilson512
Maybe calling System.halt(0)
krasenyp
itzmidinesh
I use System.stop() sometimes if I want to try graceful exit. But, I don’t think there is any issue doing Ctrl-c twice. Is there any specific reason for you to ask this?







