You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Start and Stop actually load and unload the launch daemon plist, which means that if the program crashes for any reason (e.g. another goroutine panics or something) then the daemon would be unloaded and would not start again on future system restarts for example.
I encountered this doing something a bit weird: having my service Restart itself. This works on Windows/Linux, but not macOS due to how Restart is implemented (this was easy enough to workaround by just having my process exit though.)
Another problem with this implementation is that user probably expects that in case service is currently stopped, Start() and Restart() will have identical behavior (true for systemd, for example). This implementation fails in this case, because Stopping() a service that is not running results in error, and Start() is not called.
Right now the macOS
Restart
implementation is done in terms of stopping and starting the service:service/service_darwin.go
Lines 258 to 265 in 3596dfa
Start
andStop
actually load and unload the launch daemon plist, which means that if the program crashes for any reason (e.g. another goroutine panics or something) then the daemon would be unloaded and would not start again on future system restarts for example.I encountered this doing something a bit weird: having my service
Restart
itself. This works on Windows/Linux, but not macOS due to howRestart
is implemented (this was easy enough to workaround by just having my process exit though.)I believe a better implementation may be to use kickstart with the
-k
flag as described here: https://serverfault.com/a/947469The text was updated successfully, but these errors were encountered: