diff --git a/pkg/reexec/reexec.go b/pkg/reexec/reexec.go index 774e71c76d..a5f01a26e3 100644 --- a/pkg/reexec/reexec.go +++ b/pkg/reexec/reexec.go @@ -35,8 +35,14 @@ func Self() string { name := os.Args[0] if filepath.Base(name) == name { if lp, err := exec.LookPath(name); err == nil { - name = lp + return lp } } + // handle conversion of relative paths to absolute + if absName, err := filepath.Abs(name); err == nil { + return absName + } + // if we coudn't get absolute name, return original + // (NOTE: Go only errors on Abs() if os.Getwd fails) return name }