Add support for unlimited timeouts for transcoding and thumbnail generation

This commit is contained in:
James Mills 2020-03-29 21:11:32 +10:00
parent 980a3edf63
commit 107110183a
No known key found for this signature in database
GPG key ID: AC4C014F1440EBD6
2 changed files with 27 additions and 18 deletions

File diff suppressed because one or more lines are too long

View file

@ -57,7 +57,16 @@ func CmdExists(cmd string) bool {
// RunCmd ...
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()
cmd := exec.CommandContext(ctx, command, args...)