mirror of
https://github.com/aler9/rtsp-simple-server
synced 2025-11-02 03:52:41 +08:00
close custom commands with SIGQUIT instead of SIGINT (#495)
This commit is contained in:
@@ -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)))
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user