Merge pull request #439 from danielnelson/add-host-var-envvar

Add HOST_VAR envvar and use to locate utmp on Linux.
pull/440/head
shirou 8 years ago committed by GitHub
commit 4f3240425b

@ -132,7 +132,7 @@ func Uptime() (uint64, error) {
}
func Users() ([]UserStat, error) {
utmpfile := "/var/run/utmp"
utmpfile := common.HostVar("run/utmp")
file, err := os.Open(utmpfile)
if err != nil {

@ -316,6 +316,10 @@ func HostEtc(combineWith ...string) string {
return GetEnv("HOST_ETC", "/etc", combineWith...)
}
func HostVar(combineWith ...string) string {
return GetEnv("HOST_VAR", "/var", combineWith...)
}
// https://gist.github.com/kylelemons/1525278
func Pipeline(cmds ...*exec.Cmd) ([]byte, []byte, error) {
// Require at least one command

Loading…
Cancel
Save