From 725f748b175cb866bf24cb1e772dfbb56e076996 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Mon, 17 Feb 2014 08:47:21 +0100 Subject: [PATCH] Find syncthing binary in $PATH when restarting (fixes #68) --- main.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index e35884fce..aaffb7720 100644 --- a/main.go +++ b/main.go @@ -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}, })