Start runs the specified Syncthing binary with the given arguments. Syncthing should be configured to provide an API on the address given to NewProcess. Event processing is started.
(bin string, args ...string)
| 95 | // Syncthing should be configured to provide an API on the address given to |
| 96 | // NewProcess. Event processing is started. |
| 97 | func (p *Process) Start(bin string, args ...string) error { |
| 98 | cmd := exec.Command(bin, args...) |
| 99 | if p.logfd != nil { |
| 100 | cmd.Stdout = p.logfd |
| 101 | cmd.Stderr = p.logfd |
| 102 | } |
| 103 | cmd.Env = append(os.Environ(), "STNORESTART=1", "STGUIAPIKEY="+APIKey) |
| 104 | |
| 105 | err := cmd.Start() |
| 106 | if err != nil { |
| 107 | return err |
| 108 | } |
| 109 | |
| 110 | p.cmd = cmd |
| 111 | go p.eventLoop() |
| 112 | go p.wait() |
| 113 | |
| 114 | return nil |
| 115 | } |
| 116 | |
| 117 | func (p *Process) wait() { |
| 118 | p.cmd.Wait() |
no test coverage detected