diff --git a/ffprobe.go b/ffprobe.go index 657e86e..350808e 100644 --- a/ffprobe.go +++ b/ffprobe.go @@ -34,6 +34,7 @@ func ProbeURL(ctx context.Context, fileURL string, extraFFProbeOptions ...string args = append(args, fileURL) cmd := exec.CommandContext(ctx, binPath, args...) + cmd.SysProcAttr = procAttributes() return runProbe(cmd) } @@ -55,6 +56,7 @@ func ProbeReader(ctx context.Context, reader io.Reader, extraFFProbeOptions ...s cmd := exec.CommandContext(ctx, binPath, args...) cmd.Stdin = reader + cmd.SysProcAttr = procAttributes() return runProbe(cmd) } diff --git a/proc_attr_linux.go b/proc_attr_linux.go new file mode 100644 index 0000000..1dd4bfd --- /dev/null +++ b/proc_attr_linux.go @@ -0,0 +1,13 @@ +// +build linux + +package ffprobe + +import ( + "syscall" +) + +func procAttributes() *syscall.SysProcAttr { + return &syscall.SysProcAttr{ + Pdeathsig: syscall.SIGINT, + } +} diff --git a/proc_attr_unix.go b/proc_attr_unix.go new file mode 100644 index 0000000..f6a5e33 --- /dev/null +++ b/proc_attr_unix.go @@ -0,0 +1,11 @@ +// +build !linux,!windows + +package ffprobe + +import ( + "syscall" +) + +func procAttributes() *syscall.SysProcAttr { + return nil +} diff --git a/proc_attr_windows.go b/proc_attr_windows.go new file mode 100644 index 0000000..945f8c2 --- /dev/null +++ b/proc_attr_windows.go @@ -0,0 +1,13 @@ +// +build windows + +package ffprobe + +import ( + "syscall" +) + +func procAttributes() *syscall.SysProcAttr { + return &syscall.SysProcAttr{ + HideWindow: true, + } +}