Merge pull request #428 from nileshpatra/diff-tmpdir

Make debug dir specific to username to ease off multi user logins
This commit is contained in:
Tulir Asokan 2023-07-01 14:34:59 +03:00 committed by GitHub
commit b3f0410003
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,6 +22,7 @@ import (
"io" "io"
"io/ioutil" "io/ioutil"
"os" "os"
"os/user"
"path/filepath" "path/filepath"
"runtime/debug" "runtime/debug"
"time" "time"
@ -34,7 +35,17 @@ var RecoverPrettyPanic bool
var DeadlockDetection bool var DeadlockDetection bool
var WriteLogs bool var WriteLogs bool
var OnRecover func() var OnRecover func()
var LogDirectory = filepath.Join(os.TempDir(), "gomuks") var LogDirectory = filepath.Join(os.TempDir(), "gomuks-"+getUname())
func getUname() string {
currUser, err := user.Current()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
return currUser.Username
}
func Initialize() { func Initialize() {
err := os.MkdirAll(LogDirectory, 0750) err := os.MkdirAll(LogDirectory, 0750)