diff --git a/server.go b/server.go index 6ae701f..3cd2d1a 100644 --- a/server.go +++ b/server.go @@ -290,7 +290,7 @@ func (s *server) Stop() { s.cancel() log.Printf("info: stopped the main context\n") - // Delete the socket file when the program exits. + // Delete the steward socket file when the program exits. socketFilepath := filepath.Join(s.configuration.SocketFolder, "steward.sock") if _, err := os.Stat(socketFilepath); !os.IsNotExist(err) { @@ -301,6 +301,17 @@ func (s *server) Stop() { } } + // Delete the steward socket file when the program exits. + stewSocketFilepath := filepath.Join(s.configuration.SocketFolder, "stew.sock") + + if _, err := os.Stat(stewSocketFilepath); !os.IsNotExist(err) { + err = os.Remove(stewSocketFilepath) + if err != nil { + er := fmt.Errorf("error: could not delete sock file: %v", err) + log.Printf("%v\n", er) + } + } + } // sendErrorMessage will put the error message directly on the channel that is