Close stdout pipe if process stays too long in finished state

This commit is contained in:
Ingo Oppermann 2025-07-07 16:57:19 +02:00
parent 290c612d01
commit 93ba370c3a
No known key found for this signature in database
GPG Key ID: 2AB32426E9DD229E

View File

@ -813,6 +813,11 @@ func (p *process) stop(wait bool, reason string) error {
// If the process is already in the finishing state, don't do anything
if state, _ := p.setState(stateFinishing); state == stateFinishing {
p.state.lock.RLock()
if time.Since(p.state.time) > 10*time.Second {
p.stdout.Close()
}
p.state.lock.RUnlock()
return nil
}