mirror of
https://github.com/F1bonacc1/process-compose.git
synced 2024-08-16 23:10:26 +03:00
Support nil user
This commit is contained in:
parent
eaa05812bc
commit
a149977b44
2
Makefile
2
Makefile
@ -25,7 +25,7 @@ swag:
|
||||
~/go/bin/swag init --dir src --output src/docs --parseDependency --parseInternal --parseDepth 1
|
||||
|
||||
build:
|
||||
go build -o bin/${NAME}${EXT} ${LD_FLAGS} ./src
|
||||
CGO_ENABLED=0 go build -o bin/${NAME}${EXT} ${LD_FLAGS} ./src
|
||||
|
||||
build-nix:
|
||||
nix build .
|
||||
|
9
issues/issue_84/process-compose.yaml
Normal file
9
issues/issue_84/process-compose.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
version: "0.5"
|
||||
log_level: debug
|
||||
log_length: 300
|
||||
|
||||
processes:
|
||||
clientA:
|
||||
command: "sleep 5 && touch ready"
|
||||
|
||||
|
@ -34,7 +34,11 @@ func GetLogFilePath() string {
|
||||
if found {
|
||||
return val
|
||||
}
|
||||
return filepath.Join(os.TempDir(), fmt.Sprintf("process-compose-%s%s.log", mustUser(), mode()))
|
||||
userName := getUser()
|
||||
if len(userName) != 0 {
|
||||
userName = "-" + userName
|
||||
}
|
||||
return filepath.Join(os.TempDir(), fmt.Sprintf("process-compose%s%s.log", userName, mode()))
|
||||
}
|
||||
|
||||
func procCompHome() string {
|
||||
@ -58,10 +62,11 @@ func GetShortCutsPath() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func mustUser() string {
|
||||
func getUser() string {
|
||||
usr, err := user.Current()
|
||||
if err != nil {
|
||||
log.Fatal().Err(err).Msg("Failed to retrieve user info")
|
||||
log.Warn().Err(err).Msg("Failed to retrieve user info.")
|
||||
return ""
|
||||
}
|
||||
return usr.Username
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user