Skip to content

Commit

Permalink
Clean up socket if it exists before trying to connect
Browse files Browse the repository at this point in the history
  • Loading branch information
otm committed Apr 27, 2016
1 parent 1f0fbe3 commit f501cc0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cli-handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ func NewCliHandler(address string, credsManager CredentialsManager, stop chan st
// Start handles the cli start command
func (h *CliHandler) Start() error {
// setupt socket
if _, err := os.Stat(h.address); err == nil {
errRemove := os.Remove(h.address)
if errRemove != nil {
return errRemove
}
}

h.log.Debug("Creating socket: %v\n", h.address)
localSocket, err := net.Listen("unix", h.address)
if err != nil {
Expand Down

0 comments on commit f501cc0

Please sign in to comment.