mirror of
https://github.com/xfrr/goffmpeg.git
synced 2025-10-05 14:46:51 +08:00
Added stderr to logs
This commit is contained in:
@@ -220,9 +220,10 @@ func (t *Transcoder) Run(progress bool) <-chan error {
|
||||
t.stdStdinPipe = stdin
|
||||
|
||||
// If the user has requested progress, we send it to them on a Buffer
|
||||
out := &bytes.Buffer{}
|
||||
var outb, errb bytes.Buffer
|
||||
if progress {
|
||||
proc.Stdout = out
|
||||
proc.Stdout = &outb
|
||||
proc.Stderr = &errb
|
||||
}
|
||||
|
||||
// If an input pipe has been set, we set it as stdin for the transcoding
|
||||
@@ -238,20 +239,20 @@ func (t *Transcoder) Run(progress bool) <-chan error {
|
||||
err = proc.Start()
|
||||
|
||||
t.SetProcess(proc)
|
||||
go func(err error, out *bytes.Buffer) {
|
||||
go func(err error) {
|
||||
if err != nil {
|
||||
done <- fmt.Errorf("Failed Start FFMPEG (%s) with %s, message %s", command, err, out.String())
|
||||
done <- fmt.Errorf("Failed Start FFMPEG (%s) with %s, message %s %s", command, err, outb.String(), errb.String())
|
||||
close(done)
|
||||
return
|
||||
}
|
||||
err = proc.Wait()
|
||||
go t.closePipes()
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Failed Finish FFMPEG (%s) with %s message %s", command, err, out.String())
|
||||
err = fmt.Errorf("Failed Finish FFMPEG (%s) with %s message %s %s", command, err, outb.String(), errb.String())
|
||||
}
|
||||
done <- err
|
||||
close(done)
|
||||
}(err, out)
|
||||
}(err)
|
||||
|
||||
return done
|
||||
}
|
||||
|
Reference in New Issue
Block a user