From 1bf50b564c312bc9416878f658b8c0cc87d3f0f9 Mon Sep 17 00:00:00 2001 From: Antonio Murdaca Date: Mon, 27 Apr 2015 23:11:29 +0200 Subject: [PATCH] Remove engine mechanism Signed-off-by: Antonio Murdaca --- pidfile/pidfile.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pidfile/pidfile.go b/pidfile/pidfile.go index 21a5438..7cc6b96 100644 --- a/pidfile/pidfile.go +++ b/pidfile/pidfile.go @@ -24,15 +24,15 @@ func checkPidFileAlreadyExists(path string) error { return nil } -func New(path string) (file *PidFile, err error) { +func New(path string) (*PidFile, error) { if err := checkPidFileAlreadyExists(path); err != nil { return nil, err } + if err := ioutil.WriteFile(path, []byte(fmt.Sprintf("%d", os.Getpid())), 0644); err != nil { + return nil, err + } - file = &PidFile{path: path} - err = ioutil.WriteFile(path, []byte(fmt.Sprintf("%d", os.Getpid())), 0644) - - return file, err + return &PidFile{path: path}, nil } func (file PidFile) Remove() error {