启动
()
| 188 | |
| 189 | // 启动 |
| 190 | func (this *AppCmd) runStart() { |
| 191 | var pid = this.getPID() |
| 192 | if pid > 0 { |
| 193 | fmt.Println(this.product+" already started, pid:", pid) |
| 194 | return |
| 195 | } |
| 196 | |
| 197 | _ = os.Setenv("EdgeBackground", "on") |
| 198 | |
| 199 | var cmd = exec.Command(this.exe()) |
| 200 | cmd.SysProcAttr = &syscall.SysProcAttr{ |
| 201 | Foreground: false, |
| 202 | Setsid: true, |
| 203 | } |
| 204 | |
| 205 | err := cmd.Start() |
| 206 | if err != nil { |
| 207 | fmt.Println(this.product+" start failed:", err.Error()) |
| 208 | return |
| 209 | } |
| 210 | |
| 211 | // create symbolic links |
| 212 | _ = this.createSymLinks() |
| 213 | |
| 214 | fmt.Println(this.product+" started ok, pid:", cmd.Process.Pid) |
| 215 | } |
| 216 | |
| 217 | // 停止 |
| 218 | func (this *AppCmd) runStop() { |
no test coverage detected