Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress compiled command #81

Merged
merged 2 commits into from
Mar 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 9 additions & 5 deletions run.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,12 @@ func (s *Stream) SetFfmpegPath(path string) *Stream {
return s
}

// for test
var LogCompiledCommand bool = true

func (s *Stream) Silent(isSilent bool) *Stream {
LogCompiledCommand = !isSilent
return s
}
func (s *Stream) Compile(options ...CompilationOption) *exec.Cmd {
args := s.GetArgs()
cmd := exec.CommandContext(s.Context, s.FfmpegPath, args...)
Expand All @@ -260,13 +265,12 @@ func (s *Stream) Compile(options ...CompilationOption) *exec.Cmd {
if a, ok := s.Context.Value("Stderr").(io.Writer); ok {
cmd.Stderr = a
}
for _, option := range options {
option(s, cmd)
}
for _, option := range GlobalCommandOptions {
option(cmd)
}
log.Printf("compiled command: ffmpeg %s\n", strings.Join(args, " "))
if LogCompiledCommand {
log.Printf("compiled command: ffmpeg %s\n", strings.Join(args, " "))
}
return cmd
}

Expand Down