simplify sock file exists check
This commit is contained in:
parent
adf5d8c4c9
commit
7f85672bca
|
@ -43,7 +43,7 @@ func (s *Server) Stop() {
|
||||||
|
|
||||||
func NewServer(runner *TaskRunner, config *Config) (*Server, error) {
|
func NewServer(runner *TaskRunner, config *Config) (*Server, error) {
|
||||||
//check if socket file exists
|
//check if socket file exists
|
||||||
if _, err := os.Stat(config.SocketPath); os.IsExist(err) {
|
if _, err := os.Stat(config.SocketPath); err == nil {
|
||||||
_, err := net.Dial("unix", config.SocketPath)
|
_, err := net.Dial("unix", config.SocketPath)
|
||||||
//if error then sock file was saved after crash
|
//if error then sock file was saved after crash
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue