pull/8457/head
Priya Wadhwa 2020-06-11 13:00:44 -07:00
parent 330224f36a
commit b750ab4964
1 changed files with 3 additions and 2 deletions

View File

@ -89,14 +89,15 @@ func runCmd(cmd *exec.Cmd, warnSlow ...bool) (*RunResult, error) {
killTime := 19 * time.Second // this will be applied only if warnSlow is true
warnTime := 10 * time.Second
ctx, cancel := context.WithTimeout(context.Background(), killTime)
defer cancel()
if cmd.Args[1] == "volume" || cmd.Args[1] == "ps" { // volume and ps requires more time than inspect
killTime = 30 * time.Second
warnTime = 3 * time.Second
}
ctx, cancel := context.WithTimeout(context.Background(), killTime)
defer cancel()
if warn { // convert exec.Command to with context
cmdWithCtx := exec.CommandContext(ctx, cmd.Args[0], cmd.Args[1:]...)
cmdWithCtx.Stdout = cmd.Stdout //copying the original command