From 9505cd5d4a662b9f61850c814873c198babb5029 Mon Sep 17 00:00:00 2001 From: Daniel A Date: Mon, 22 Apr 2024 19:23:01 +0000 Subject: [PATCH] fix: avoid race condition by not running exec/start twice --- pkg/container/client.go | 7 ------- pkg/container/client_test.go | 9 --------- 2 files changed, 16 deletions(-) diff --git a/pkg/container/client.go b/pkg/container/client.go index c6c37de..de92f6c 100644 --- a/pkg/container/client.go +++ b/pkg/container/client.go @@ -463,13 +463,6 @@ func (client dockerClient) ExecuteCommand(containerID t.ContainerID, command str clog.Errorf("Failed to extract command exec logs: %v", attachErr) } - // Run the exec - execStartCheck := types.ExecStartCheck{Detach: false, Tty: true} - err = client.api.ContainerExecStart(bg, exec.ID, execStartCheck) - if err != nil { - return false, err - } - var output string if attachErr == nil { defer response.Close() diff --git a/pkg/container/client_test.go b/pkg/container/client_test.go index 4e75409..fddc7c3 100644 --- a/pkg/container/client_test.go +++ b/pkg/container/client_test.go @@ -282,15 +282,6 @@ var _ = Describe("the client", func() { }), ghttp.RespondWithJSONEncoded(http.StatusOK, types.IDResponse{ID: execID}), ), - // API.ContainerExecStart - ghttp.CombineHandlers( - ghttp.VerifyRequest("POST", HaveSuffix("exec/%v/start", execID)), - ghttp.VerifyJSONRepresenting(types.ExecStartCheck{ - Detach: false, - Tty: true, - }), - ghttp.RespondWith(http.StatusOK, nil), - ), // API.ContainerExecInspect ghttp.CombineHandlers( ghttp.VerifyRequest("GET", HaveSuffix("exec/ex-exec-id/json")),