Merge pull request #6144 from hashicorp/b-docker-exec

docker: Fix issue where an exec may never timeout
This commit is contained in:
Danielle 2019-08-16 15:53:50 +02:00 committed by GitHub
commit e943ef3ac6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1323,7 +1323,7 @@ func (d *Driver) ExecTaskStreaming(ctx context.Context, taskID string, opts *dri
const execTerminatingTimeout = 3 * time.Second
start := time.Now()
var res *docker.ExecInspect
for res == nil || res.Running || time.Since(start) > execTerminatingTimeout {
for (res == nil || res.Running) && time.Since(start) <= execTerminatingTimeout {
res, err = client.InspectExec(exec.ID)
if err != nil {
return nil, fmt.Errorf("failed to inspect exec result: %v", err)