Move platform-specific code under build tags; fix corresponding tests

This commit is contained in:
Denis Borzenko
2023-02-28 22:55:03 +03:00
parent 752c6e045d
commit 2a41acb422
5 changed files with 43 additions and 17 deletions

10
run.go
View File

@@ -9,7 +9,6 @@ import (
"os/exec"
"sort"
"strings"
"syscall"
"time"
)
@@ -239,15 +238,6 @@ func (s *Stream) ErrorToStdOut() *Stream {
type CompilationOption func(s *Stream, cmd *exec.Cmd)
// SeparateProcessGroup ensures that the command is run in a separate process
// group. This is useful to enable handling of signals such as SIGINT without
// propagating them to the ffmpeg process.
func SeparateProcessGroup() CompilationOption {
return func(s *Stream, cmd *exec.Cmd) {
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true, Pgid: 0}
}
}
func (s *Stream) SetFfmpegPath(path string) *Stream {
s.FfmpegPath = path
return s