mirror of
https://git.freecumextremist.com/grumbulon/pomme.git
synced 2024-11-24 17:13:47 +00:00
adding sys.go and using /x/sys/unix for killing pomme, because syscall package is deprecated. Added small wrapper for killPomme().
This commit is contained in:
parent
25229f9c81
commit
b8d4af58c8
4 changed files with 17 additions and 5 deletions
2
go.mod
2
go.mod
|
@ -53,7 +53,7 @@ require (
|
|||
github.com/swaggo/http-swagger v1.3.3
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
|
||||
golang.org/x/net v0.5.0 // indirect
|
||||
golang.org/x/sys v0.4.0 // indirect
|
||||
golang.org/x/sys v0.4.0
|
||||
golang.org/x/tools v0.1.12 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
modernc.org/libc v1.21.5 // indirect
|
||||
|
|
2
go.sum
2
go.sum
|
@ -185,8 +185,6 @@ gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C
|
|||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gorm.io/gorm v1.24.2/go.mod h1:DVrVomtaYTbqs7gB/x2uVvqnXzv0nqjB396B8cG4dBA=
|
||||
gorm.io/gorm v1.24.3 h1:WL2ifUmzR/SLp85CSURAfybcHnGZ+yLSGSxgYXlFBHg=
|
||||
gorm.io/gorm v1.24.3/go.mod h1:DVrVomtaYTbqs7gB/x2uVvqnXzv0nqjB396B8cG4dBA=
|
||||
gorm.io/gorm v1.24.5 h1:g6OPREKqqlWq4kh/3MCQbZKImeB9e6Xgc4zD+JgNZGE=
|
||||
gorm.io/gorm v1.24.5/go.mod h1:DVrVomtaYTbqs7gB/x2uVvqnXzv0nqjB396B8cG4dBA=
|
||||
lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk=
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"git.freecumextremist.com/grumbulon/pomme/internal"
|
||||
|
@ -35,7 +34,7 @@ func setDBMiddleware(next http.Handler) http.Handler {
|
|||
|
||||
if err != nil && !ok {
|
||||
logHandler(genericResponseFields{"error": err.Error(), "message": "Error initializing DB"})
|
||||
err = syscall.Kill(syscall.Getpid(), syscall.SIGINT)
|
||||
err = internal.SysKill()
|
||||
if err != nil {
|
||||
panic("idk what to do with this but syscall.Kill errored out.")
|
||||
}
|
||||
|
|
15
internal/sys.go
Normal file
15
internal/sys.go
Normal file
|
@ -0,0 +1,15 @@
|
|||
package internal
|
||||
|
||||
import "golang.org/x/sys/unix"
|
||||
|
||||
func SysKill() (err error) {
|
||||
err = killPomme()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func killPomme() (err error) {
|
||||
err = unix.Kill(unix.Getpid(), unix.SIGINT)
|
||||
|
||||
return
|
||||
}
|
Loading…
Reference in a new issue