added sleep to prevent termbox race condition

This commit is contained in:
Alex Goodman 2019-09-22 22:43:30 -04:00
parent 0364bf8702
commit 5a65ba566c
No known key found for this signature in database
GPG Key ID: 98AF011C5C78EB7E

View File

@ -8,6 +8,7 @@ import (
"io/ioutil"
"log"
"os"
"time"
"github.com/dustin/go-humanize"
"github.com/wagoodman/dive/dive/filetree"
@ -113,6 +114,13 @@ func Run(options Options) {
cache := filetree.NewFileTreeCache(result.RefTrees)
cache.Build()
// it appears there is a race condition where termbox.Init() will
// block nearly indefinitely when running as the first process in
// a Docker container when started within ~25ms of container startup.
// I can't seem to determine the exact root cause, however, a large
// enough sleep will prevent this behavior (todo: remove this hack)
time.Sleep(100 * time.Millisecond)
ui.Run(result, cache)
}
}