mirror of
https://github.com/u2takey/ffmpeg-go.git
synced 2025-10-01 22:32:09 +08:00
Close u2takey/ffmpeg-go#80
Discover CommandOption type and ffmpeg.GlobalCommandOptions array, that is processed before running ffmpeg or ffprobe commands. Add tests.
This commit is contained in:
@@ -18,3 +18,18 @@ func TestCompileWithOptions(t *testing.T) {
|
||||
})
|
||||
assert.Equal(t, true, cmd.SysProcAttr.HideWindow)
|
||||
}
|
||||
|
||||
func TestGlobalCommandOptions(t *testing.T) {
|
||||
out := Input("dummy.mp4").Output("dummy2.mp4")
|
||||
GlobalCommandOptions = append(GlobalCommandOptions, func(cmd *exec.Cmd) {
|
||||
if cmd.SysProcAttr == nil {
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{}
|
||||
}
|
||||
cmd.SysProcAttr.HideWindow = true
|
||||
})
|
||||
defer func() {
|
||||
GlobalCommandOptions = GlobalCommandOptions[0 : len(GlobalCommandOptions)-1]
|
||||
}()
|
||||
cmd := out.Compile()
|
||||
assert.Equal(t, true, cmd.SysProcAttr.HideWindow)
|
||||
}
|
||||
|
Reference in New Issue
Block a user