This commit is contained in:
crusader 2018-03-22 21:31:47 +09:00
parent ffeccef8d8
commit ba6bb15295

View File

@ -52,8 +52,10 @@ func (sh *ServerHandlers) Listen(serverCTX server.ServerContext) (net.Listener,
func (sh *ServerHandlers) OnStart(serverCTX server.ServerContext) {
sh.ServerHandlers.OnStart(serverCTX)
if err := os.Remove(sh.pidPath); nil != err {
logging.Logger().Errorf("Container: Removing pid file has been failed [%v]", err)
if _, err := os.Stat(sh.pidPath); os.IsExist(err) {
if err := os.Remove(sh.pidPath); nil != err {
logging.Logger().Errorf("Container: Removing pid file has been failed [%v]", err)
}
}
s := strconv.FormatInt(int64(sh.port), 10)
@ -61,8 +63,10 @@ func (sh *ServerHandlers) OnStart(serverCTX server.ServerContext) {
}
func (sh *ServerHandlers) OnStop(serverCTX server.ServerContext) {
if err := os.Remove(sh.pidPath); nil != err {
logging.Logger().Errorf("Container: Removing pid file has been failed [%v]", err)
if _, err := os.Stat(sh.pidPath); os.IsExist(err) {
if err := os.Remove(sh.pidPath); nil != err {
logging.Logger().Errorf("Container: Removing pid file has been failed [%v]", err)
}
}
sh.ServerHandlers.OnStop(serverCTX)