X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=lib%2Fsyncthing%2Fst.go;h=1f7875749eddc42952413fe10a722fd8b44bc96a;hb=41109938056e2c0ca3af355de8947380e9a3b557;hp=88d0eb0ca93805f18527c67e8dc651a0a2920323;hpb=36e2400d1c0249e81f910e48a967e0202d5a8d46;p=src%2Fxds%2Fxds-agent.git diff --git a/lib/syncthing/st.go b/lib/syncthing/st.go index 88d0eb0..1f78757 100644 --- a/lib/syncthing/st.go +++ b/lib/syncthing/st.go @@ -95,9 +95,17 @@ func (s *SyncThing) startProc(exeName string, args []string, env []string, eChan exec.Command("bash", "-c", "pkill -9 "+exeName).Output() } - path, err := exec.LookPath(path.Join(s.binDir, exeName)) + // When not set (or set to '.') set bin to path of xds-agent executable + bdir := s.binDir + if bdir == "" || bdir == "." { + if dir, err := filepath.Abs(filepath.Dir(os.Args[0])); err == nil { + bdir = dir + } + } + + path, err := exec.LookPath(path.Join(bdir, exeName)) if err != nil { - return nil, fmt.Errorf("Cannot find %s executable in %s", exeName, s.binDir) + return nil, fmt.Errorf("Cannot find %s executable in %s", exeName, bdir) } cmd := exec.Command(path, args...) cmd.Env = os.Environ() @@ -170,7 +178,6 @@ func (s *SyncThing) Start() (*exec.Cmd, error) { env := []string{ "STNODEFAULTFOLDER=1", "STNOUPGRADE=1", - "STNORESTART=1", } // XXX - temporary hack because -gui-apikey seems to correctly handle by @@ -301,7 +308,9 @@ func (s *SyncThing) Connect() error { return fmt.Errorf("ERROR: cannot connect to Syncthing (null client)") } - s.client.SetLogger(s.log) + s.client.SetLogLevel(s.log.Level.String()) + s.client.LoggerPrefix = "SYNCTHING: " + s.client.LoggerOut = s.log.Out return nil }