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:
parent
10a12816fa
commit
59bd699065
5 changed files with 7 additions and 38 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
module internal/pid
|
||||
|
||||
go 1.14
|
||||
|
|
@ -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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue