refactor: create pid file.

This commit is contained in:
Bo-Yi Wu 2017-01-07 18:45:34 +08:00
parent 975a6f8fab
commit fd22832e7c
1 changed files with 1 additions and 2 deletions

View File

@ -72,8 +72,7 @@ func createPIDFile() error {
return fmt.Errorf("Can't create PID file: %v", err) return fmt.Errorf("Can't create PID file: %v", err)
} }
defer file.Close() defer file.Close()
_, err = file.WriteString(strconv.FormatInt(int64(currentPid), 10)) if _, err := file.WriteString(strconv.FormatInt(int64(currentPid), 10)); err != nil {
if err != nil {
return fmt.Errorf("Can'write PID information on %s: %v", gorush.PushConf.Core.PID.Path, err) return fmt.Errorf("Can'write PID information on %s: %v", gorush.PushConf.Core.PID.Path, err)
} }
} else { } else {