mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-05 16:12:20 +00:00
Find syncthing binary in $PATH when restarting (fixes #68)
This commit is contained in:
parent
f89fa6caed
commit
8f0a015abf
8
main.go
8
main.go
@ -10,6 +10,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
_ "net/http/pprof"
|
_ "net/http/pprof"
|
||||||
"os"
|
"os"
|
||||||
|
"os/exec"
|
||||||
"path"
|
"path"
|
||||||
"runtime"
|
"runtime"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
@ -279,7 +280,12 @@ func restart() {
|
|||||||
if doAppend {
|
if doAppend {
|
||||||
args = append(args, "-delay", "2")
|
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(),
|
Env: os.Environ(),
|
||||||
Files: []*os.File{os.Stdin, os.Stdout, os.Stderr},
|
Files: []*os.File{os.Stdin, os.Stdout, os.Stderr},
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user