markdown-live-preview icon indicating copy to clipboard operation
markdown-live-preview copied to clipboard

A method or http route to cleanly shutdown the server

Open ErgoCreate opened this issue 1 year ago • 2 comments

I have been tinkering with this amazing software with the intent of incorporating it into a mardown edition software, but it needs to run as a background service when i run my user interface, and i have problems to cleanly exit my process because the server doesn't exit when the rest of the program does. (i'm running it in a thread at the moment).

Is there a way to add something like a "http://localhost:3000/quit" route to tell the server to shutdown?

Is there a better way to cleanly shutdown the server from another thread? I know i too can kill the process if i start it as a subprocess, but i'm looking for a better option.

ErgoCreate avatar Nov 15 '24 20:11 ErgoCreate

oh my god please don't do that, i hope you are not serious. i made this program more or less for myself, it should work, and i will update it from time to time, but please don't rely on it. :/

anyways, sending the process SIGTERM should do it

ms-jpq avatar Nov 16 '24 17:11 ms-jpq

Well, that it keeps the dark theme and follows automatically the changes are very nice features that other live markdown preview servers don't have 😕, and the software i am making is just for myself, so don't worry. I understand if this is experimental, i have a ton of experimental programs for myself too.

By the way, I ended up running it as a subprocess and killing the process on exit.

Anyways, I added live math support and this is how it is coming along!

https://github.com/user-attachments/assets/a2036d01-c318-46c6-8200-96e3fdd74a7e

ErgoCreate avatar Nov 18 '24 22:11 ErgoCreate