Remove engine mechanism
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
This commit is contained in:
parent
861cba008d
commit
1bf50b564c
1 changed files with 5 additions and 5 deletions
|
@ -24,15 +24,15 @@ func checkPidFileAlreadyExists(path string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(path string) (file *PidFile, err error) {
|
func New(path string) (*PidFile, error) {
|
||||||
if err := checkPidFileAlreadyExists(path); err != nil {
|
if err := checkPidFileAlreadyExists(path); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if err := ioutil.WriteFile(path, []byte(fmt.Sprintf("%d", os.Getpid())), 0644); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
file = &PidFile{path: path}
|
return &PidFile{path: path}, nil
|
||||||
err = ioutil.WriteFile(path, []byte(fmt.Sprintf("%d", os.Getpid())), 0644)
|
|
||||||
|
|
||||||
return file, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (file PidFile) Remove() error {
|
func (file PidFile) Remove() error {
|
||||||
|
|
Loading…
Reference in a new issue