githubnemo / CompileDaemon

Very simple compile daemon for Go
BSD 2-Clause "Simplified" License
1.61k stars 153 forks source link

Restart the program if it fails #72

Open mitar opened 2 years ago

mitar commented 2 years ago

Sometimes a running program fails because of the panic. Because CompileDaemon keeps running it is hard to notice that (except for the panic stack trace). I think it would be best if CompileDaemon would just restart the program, with some message (like, "program terminated, restarting"). Probably as opt-in CLI flag.

githubnemo commented 2 years ago

If you need more sophisticated job management I would recommend using a shell script that launches the executable and watches for the actual program. A very simple one would be something like

#!/bin/bash

while true; do
    ./my_go_executable "$@"
    sleep 5 # avoid flooding the system with crashing applications
done

I don't think this is a job for CompileDaemon :)

asalkeld commented 2 years ago

I have a commit on a fork that does this: https://github.com/asalkeld/CompileDaemon/commit/238f1e64517ec5442a6b0e9ea2b3479978b7b74b If you are interested, I'll happily make a PR.