we got some dhrek we got some doneky we got some fienona

This commit is contained in:
Sasha Koshka
2023-06-01 03:37:08 -04:00
parent 32bc44c90f
commit 7726d732d4
4 changed files with 85 additions and 58 deletions

View File

@@ -6,7 +6,6 @@ import "fmt"
import "time"
import "errors"
import "syscall"
import "os/user"
import "strconv"
import "path/filepath"
@@ -45,24 +44,6 @@ func Spawn (path string, uid, gid uint32, env []string, args ...string) (pid int
return process.Pid, process.Release()
}
// LookupUID returns the uid and gid of the given username, if it exists.
func LookupUID (name string) (uid, gid uint32, err error) {
user, err := user.Lookup(name)
if err != nil {
return 0, 0, err
}
puid, err := strconv.Atoi(user.Uid)
if err != nil {
return 0, 0, err
}
pgid, err := strconv.Atoi(user.Gid)
if err != nil {
return 0, 0, err
}
return uint32(puid), uint32(pgid), nil
}
// PidFile returns the path of a pidfile under the specified name. More
// specifically, it returns `/run/<name>.pid`.
func PidFile (name string) string {