From f96a6285bf215ff9f7a3e06bda9f4d74065fc205 Mon Sep 17 00:00:00 2001 From: astaxie Date: Fri, 27 Feb 2015 22:21:58 +0800 Subject: [PATCH] fix #978 --- app.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app.go b/app.go index d155c531..35040f33 100644 --- a/app.go +++ b/app.go @@ -19,7 +19,10 @@ import ( "net" "net/http" "net/http/fcgi" + "os" "time" + + "github.com/astaxie/beego/utils" ) // App defines beego application with a new PatternServeMux. @@ -59,6 +62,10 @@ func (app *App) Run() { } } else { if HttpPort == 0 { + // remove the Socket file before start + if utils.FileExists(addr) { + os.Remove(addr) + } l, err = net.Listen("unix", addr) } else { l, err = net.Listen("tcp", addr)