Files
goffmpeg/transcoder/command.go
frr e545a08502 command wrapper
making transcoder
2018-01-28 14:15:41 +01:00

29 lines
389 B
Go

package transcoder
import (
"fmt"
"log"
"os/exec"
)
type Worker struct {
Command string
Args string
Output chan string
}
func (cmd *Worker) Run() {
out, err := exec.Command(cmd.Command, cmd.Args).Output()
if err != nil {
log.Fatal(err)
}
cmd.Output <- string(out)
}
func Collect(c chan string) {
for {
msg := <-c
fmt.Printf("The command result is %s\n", msg)
}
}