1
0
Fork 0
mirror of https://github.com/eosswedenorg/antelope-api-healthcheck synced 2026-07-04 12:03:43 +02:00

Adding src/pid/pid.go

This commit is contained in:
Henrik Hautakoski 2020-06-11 19:00:03 +02:00
parent 2b823c1dd3
commit 060535f595

28
src/pid/pid.go Normal file
View file

@ -0,0 +1,28 @@
package pid
import (
"os"
"strconv"
)
func Get() (int) {
return os.Getpid()
}
func Save(path string) (int, error) {
pid := Get()
fd, err := os.Create(path)
if err != nil {
return -1, err
}
_, err = fd.WriteString(strconv.Itoa(pid))
if err != nil {
return -1, err
}
return pid, nil
}