mirror of
https://github.com/aler9/rtsp-simple-server
synced 2025-11-01 19:42:37 +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) {
|
func TestRTSPServerRunOnDemand(t *testing.T) {
|
||||||
doneFile := filepath.Join(os.TempDir(), "ondemand_done")
|
doneFile := filepath.Join(os.TempDir(), "ondemand_done")
|
||||||
onDemandFile, err := writeTempFile([]byte(fmt.Sprintf(`#!/bin/sh
|
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 &
|
ffmpeg -hide_banner -loglevel error -re -i ../../testimages/ffmpeg/emptyvideo.mkv -c copy -f rtsp rtsp://localhost:$RTSP_PORT/$RTSP_PATH &
|
||||||
wait
|
wait
|
||||||
`, doneFile)))
|
`, doneFile)))
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ package externalcmd
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (e *Cmd) runInner() bool {
|
func (e *Cmd) runInner() bool {
|
||||||
@@ -31,7 +32,7 @@ func (e *Cmd) runInner() bool {
|
|||||||
|
|
||||||
select {
|
select {
|
||||||
case <-e.terminate:
|
case <-e.terminate:
|
||||||
cmd.Process.Signal(os.Interrupt)
|
syscall.Kill(cmd.Process.Pid, syscall.SIGQUIT)
|
||||||
<-cmdDone
|
<-cmdDone
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user