mirror of
https://github.com/postmannen/ctrl.git
synced 2024-12-14 12:37:31 +00:00
added removal of stew.sock on exit
This commit is contained in:
parent
2028cf9040
commit
14493e2a4a
1 changed files with 12 additions and 1 deletions
13
server.go
13
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
|
||||
|
|
Loading…
Reference in a new issue