pumpCmd blocks on ch and returns each message. When ch closes, emits a sentinel runExitMsg with a nil err so the model clears its state.
(ch <-chan tea.Msg)
| 241 | // pumpCmd blocks on ch and returns each message. When ch closes, emits a |
| 242 | // sentinel runExitMsg with a nil err so the model clears its state. |
| 243 | func pumpCmd(ch <-chan tea.Msg) tea.Cmd { |
| 244 | return func() tea.Msg { |
| 245 | msg, ok := <-ch |
| 246 | if !ok { |
| 247 | return runExitMsg{err: nil} |
| 248 | } |
| 249 | return msg |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | // stop sends SIGINT (Unix) or Kill (Windows) to the engine subprocess. |
| 254 | func (m runModel) stop() tea.Cmd { |