MCPcopy Index your code
hub / github.com/DarthSim/overmind / observe

Method observe

start/process.go:171–196  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

169}
170
171func (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
198func (p *process) respawn() {
199 p.output.WriteBoldLine(p, []byte("Restarting..."))

Callers 1

StartObservingMethod · 0.95

Calls 5

RunningMethod · 0.95
respawnMethod · 0.95
WriteBoldLinefMethod · 0.80
PaneExitCodeMethod · 0.80
StopMethod · 0.45

Tested by

no test coverage detected