Added stderr to logs

This commit is contained in:
muhammadharis
2019-11-14 11:30:09 -05:00
parent f96bd1d964
commit 5b0e610c95

View File

@@ -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
}