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

View File

@@ -140,3 +140,12 @@ func (s *Stream) RunLinux() error {
return cmd.Wait()
}
// 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}
}
}