stop sends SIGINT (Unix) or Kill (Windows) to the engine subprocess.
()
| 252 | |
| 253 | // stop sends SIGINT (Unix) or Kill (Windows) to the engine subprocess. |
| 254 | func (m runModel) stop() tea.Cmd { |
| 255 | return func() tea.Msg { |
| 256 | m.st.mu.Lock() |
| 257 | defer m.st.mu.Unlock() |
| 258 | if m.st.cmd == nil || m.st.cmd.Process == nil { |
| 259 | return statusMsg("engine not running") |
| 260 | } |
| 261 | p := m.st.cmd.Process |
| 262 | if runtime.GOOS == "windows" { |
| 263 | _ = p.Kill() |
| 264 | } else { |
| 265 | _ = p.Signal(syscall.SIGINT) |
| 266 | } |
| 267 | return statusMsg("engine stopping") |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | type runLogMsg string |
| 272 | type runExitMsg struct{ err error } |