added generic user lookup and foreground processes
This commit is contained in:
parent
4b88a07ef5
commit
1e230617ce
7 changed files with 134 additions and 50 deletions
23
lookup_cgo.go
Normal file
23
lookup_cgo.go
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2017 Marius Schellenberger
|
||||
|
||||
// +build cgo
|
||||
|
||||
package godrop
|
||||
|
||||
import "os/user"
|
||||
|
||||
func lookupUID(username string) (string, error) {
|
||||
u, err := user.Lookup(username)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return u.Uid, err
|
||||
}
|
||||
|
||||
func lookupGID(name string) (string, error) {
|
||||
g, err := user.LookupGroup(name)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return g.Gid, err
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue