fix lint
parent
330224f36a
commit
b750ab4964
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue