diff options
author | lawl <github@dumbinter.net> | 2020-07-19 12:08:25 +0200 |
---|---|---|
committer | lawl <github@dumbinter.net> | 2020-07-19 12:08:25 +0200 |
commit | 23e32356c6ca5e1cbd8b2464706908c41c2db46b (patch) | |
tree | 0f112776f852cfefefb6d294eb78afb578be3e4c | |
parent | 93fe38ec41037aa869d8c752ec96b7b7776e184b (diff) | |
download | noisetorch-23e32356c6ca5e1cbd8b2464706908c41c2db46b.tar.gz noisetorch-23e32356c6ca5e1cbd8b2464706908c41c2db46b.zip |
Use fallback if RUNTIME_DIR not set
-rw-r--r-- | rlimit.go | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1,6 +1,7 @@ package main import ( + "fmt" "io/ioutil" "log" "os" @@ -15,8 +16,7 @@ import ( const rlimitRTTime = 15 func getPulsePid() (int, error) { - runtimeDir := os.Getenv("XDG_RUNTIME_DIR") - pulsepidfile := filepath.Join(runtimeDir, "pulse/pid") + pulsepidfile := filepath.Join(xdgOrFallback("XDG_RUNTIME_DIR", fmt.Sprintf("/run/user/%d", os.Getuid())), "pulse/pid") pidbuf, err := ioutil.ReadFile(pulsepidfile) if err != nil { return 0, err |