Merge pull request #147 from github/cleanup-socket-file

Cleanup socket file
This commit is contained in:
Shlomi Noach 2016-08-12 11:26:37 +02:00 committed by GitHub
commit 8bf07c506f
2 changed files with 7 additions and 0 deletions

View File

@ -399,6 +399,8 @@ func (this *Migrator) Migrate() (err error) {
if err := this.initiateServer(); err != nil {
return err
}
defer this.server.RemoveSocketFile()
if this.migrationContext.CountTableRows {
if this.migrationContext.Noop {
log.Debugf("Noop operation; not really counting table rows")

View File

@ -47,6 +47,11 @@ func (this *Server) BindSocketFile() (err error) {
return nil
}
func (this *Server) RemoveSocketFile() (err error) {
log.Infof("Removing socket file: %s", this.migrationContext.ServeSocketFile)
return os.Remove(this.migrationContext.ServeSocketFile)
}
func (this *Server) BindTCPPort() (err error) {
if this.migrationContext.ServeTCPPort == 0 {
return nil