close custom commands with SIGQUIT instead of SIGINT (#495)

This commit is contained in:
aler9
2021-08-12 15:16:39 +02:00
parent ceed37838e
commit d7f1c04711
2 changed files with 3 additions and 2 deletions

View File

@@ -741,7 +741,7 @@ func TestRTSPServerFallback(t *testing.T) {
func TestRTSPServerRunOnDemand(t *testing.T) {
doneFile := filepath.Join(os.TempDir(), "ondemand_done")
onDemandFile, err := writeTempFile([]byte(fmt.Sprintf(`#!/bin/sh
trap 'touch %s; [ -z "$(jobs -p)" ] || kill $(jobs -p)' INT
trap 'touch %s; [ -z "$(jobs -p)" ] || kill $(jobs -p)' QUIT
ffmpeg -hide_banner -loglevel error -re -i ../../testimages/ffmpeg/emptyvideo.mkv -c copy -f rtsp rtsp://localhost:$RTSP_PORT/$RTSP_PATH &
wait
`, doneFile)))

View File

@@ -5,6 +5,7 @@ package externalcmd
import (
"os"
"os/exec"
"syscall"
)
func (e *Cmd) runInner() bool {
@@ -31,7 +32,7 @@ func (e *Cmd) runInner() bool {
select {
case <-e.terminate:
cmd.Process.Signal(os.Interrupt)
syscall.Kill(cmd.Process.Pid, syscall.SIGQUIT)
<-cmdDone
return false