mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-22 09:00:10 +00:00
systemd: get executable path properly
was just evaluating os.Args[0], which incorrectly points to your current directory if jfa-go was in your PATH (i.e. you ran `jfa-go` not `/usr/bin/jfa-go`). Uses Go's os.Executable() now. Fixes #352.
This commit is contained in:
parent
3c28537498
commit
8f3c723b07
2
main.go
2
main.go
@ -787,7 +787,7 @@ func main() {
|
|||||||
fmt.Printf(lm.FailedReading+"\n", SYSTEMD_SERVICE, err)
|
fmt.Printf(lm.FailedReading+"\n", SYSTEMD_SERVICE, err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
absPath, err := filepath.Abs(os.Args[0])
|
absPath, err := os.Executable()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
absPath = os.Args[0]
|
absPath = os.Args[0]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user