Find syncthing binary in $PATH when restarting (fixes #68)

This commit is contained in:
Jakob Borg 2014-02-17 08:47:21 +01:00
parent f3a793ce91
commit 725f748b17

View File

@ -10,6 +10,7 @@ import (
"net/http"
_ "net/http/pprof"
"os"
"os/exec"
"path"
"runtime"
"runtime/debug"
@ -279,7 +280,12 @@ func restart() {
if doAppend {
args = append(args, "-delay", "2")
}
proc, err := os.StartProcess(os.Args[0], args, &os.ProcAttr{
pgm, err := exec.LookPath(os.Args[0])
if err != nil {
warnln(err)
return
}
proc, err := os.StartProcess(pgm, args, &os.ProcAttr{
Env: os.Environ(),
Files: []*os.File{os.Stdin, os.Stdout, os.Stderr},
})