kardianos / service

Run go programs as a service on major platforms.
zlib License
4.45k stars 678 forks source link

Make sure that zombie processes are cleaned up #371

Open alextoulps opened 1 year ago

alextoulps commented 1 year ago

As there is a usage of cmd.Start() ensure that Wait() will be called to clean up resources. Currently in a running app that might poll for the status, this causes a leak.

ovoschnoi-salat commented 1 year ago

You put it in a wrong place, you should ensure calling Wait only after Start is called without errors

alextoulps commented 1 year ago

You put it in a wrong place, you should ensure calling Wait only after Start is called without errors

Yeah was also debating if it should be right after the Start but since it is a defer and the implementation of Wait will in worst case return an error that will be ignored, i wanted to follow the practice of ensuring defer call right after the initialisation of the resource that needs to ensure clean up of resources.