Add support for unlimited timeouts for transcoding and thumbnail generation
This commit is contained in:
parent
980a3edf63
commit
107110183a
2 changed files with 27 additions and 18 deletions
File diff suppressed because one or more lines are too long
|
@ -57,7 +57,16 @@ func CmdExists(cmd string) bool {
|
||||||
|
|
||||||
// RunCmd ...
|
// RunCmd ...
|
||||||
func RunCmd(timeout int, command string, args ...string) error {
|
func RunCmd(timeout int, command string, args ...string) error {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(timeout)*time.Second)
|
var (
|
||||||
|
ctx context.Context
|
||||||
|
cancel context.CancelFunc
|
||||||
|
)
|
||||||
|
|
||||||
|
if timeout > 0 {
|
||||||
|
ctx, cancel = context.WithTimeout(context.Background(), time.Duration(timeout)*time.Second)
|
||||||
|
} else {
|
||||||
|
ctx, cancel = context.WithCancel(context.Background())
|
||||||
|
}
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
cmd := exec.CommandContext(ctx, command, args...)
|
cmd := exec.CommandContext(ctx, command, args...)
|
||||||
|
|
Loading…
Reference in a new issue