Wait for process to exit when stopping

If a process has some cleanup with purge-on-delete defined, the purge
has to wait until the process actually exited. Otherwise it may happen
that the process got the signal, files are purged, but the process is
still writing some files in order to exit cleanly. This would lead to
some artefacts left on the filesystem.
This commit is contained in:
Ingo Oppermann
2022-08-17 15:12:22 +03:00
parent e4463953b6
commit 50deaef4d3
5 changed files with 92 additions and 26 deletions

View File

@@ -204,7 +204,7 @@ func (r *restream) Stop() {
// Start() they will get restarted.
for id, t := range r.tasks {
if t.ffmpeg != nil {
t.ffmpeg.Stop()
t.ffmpeg.Stop(true)
}
r.unsetCleanup(id)
@@ -996,7 +996,7 @@ func (r *restream) stopProcess(id string) error {
task.process.Order = "stop"
task.ffmpeg.Stop()
task.ffmpeg.Stop(true)
r.nProc--
@@ -1024,7 +1024,7 @@ func (r *restream) restartProcess(id string) error {
return nil
}
task.ffmpeg.Kill()
task.ffmpeg.Kill(true)
return nil
}