()
| 169 | } |
| 170 | |
| 171 | func (p *process) observe() { |
| 172 | ticker := time.NewTicker(runningCheckInterval) |
| 173 | defer ticker.Stop() |
| 174 | |
| 175 | for range ticker.C { |
| 176 | if !p.Running() { |
| 177 | if !p.keepingAlive { |
| 178 | p.out.Close() |
| 179 | p.output.WriteBoldLinef(p, "Exited with code %d", p.tmux.PaneExitCode(p.paneID)) |
| 180 | p.keepingAlive = true |
| 181 | } |
| 182 | |
| 183 | if !p.canDieNow { |
| 184 | p.keepingAlive = false |
| 185 | p.pid = 0 |
| 186 | |
| 187 | if p.restart || (!p.interrupted && p.autoRestart) { |
| 188 | p.respawn() |
| 189 | } else { |
| 190 | p.dead = true |
| 191 | break |
| 192 | } |
| 193 | } |
| 194 | } |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | func (p *process) respawn() { |
| 199 | p.output.WriteBoldLine(p, []byte("Restarting...")) |
no test coverage detected