Skip to content

Commit

Permalink
Updated how to get executable name
Browse files Browse the repository at this point in the history
  • Loading branch information
mattiasrunge committed Feb 4, 2022
1 parent f8e3a62 commit 6776a69
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions internal/proc/daemonctrl/spawn.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,17 @@ func Spawn() error {
},
Sys: sysproc,
}
dirname, _ := os.Getwd()
binary := os.Args[0]

fmt.Println("Binary:", binary)
if strings.Contains(binary, "/go-build") {
binary = "barf.sh" // For development
executable, err := os.Executable()
if err != nil {
return err
}

var executable = path.Join(dirname, binary)
fmt.Println("Binary:", executable)
if strings.Contains(os.Args[0], "/go-build") {
binary := "barf.sh" // For development
dirname, _ := os.Getwd()
executable = path.Join(dirname, binary)
}

process, err := os.StartProcess(executable, []string{executable, "background"}, &attr)

Expand Down

0 comments on commit 6776a69

Please sign in to comment.