1
0
Fork 0
mirror of https://github.com/eosswedenorg/antelope-api-healthcheck synced 2026-06-18 05:00:03 +02:00

Replace local pid module with the one located at github.com/eosswedenorg-go/pid

This commit is contained in:
Henrik Hautakoski 2022-01-03 12:05:10 +01:00
parent 10a12816fa
commit 59bd699065
No known key found for this signature in database
GPG key ID: 608414D93E862CCD
5 changed files with 7 additions and 38 deletions

View file

@ -6,7 +6,7 @@ import (
"os/signal"
"syscall"
"internal/log"
"internal/pid"
"github.com/eosswedenorg-go/pid"
"github.com/pborman/getopt/v2"
)
@ -130,7 +130,7 @@ func main() {
if len(pidFile) > 0 {
log.Info("Writing pidfile: %s", pidFile)
_, err := pid.Save(pidFile)
err := pid.Save(pidFile)
if err != nil {
log.Error("Failed to write pidfile: %v", err)
}

View file

@ -1,3 +0,0 @@
module internal/pid
go 1.14

View file

@ -1,28 +0,0 @@
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
}