diff --git a/integration-cli/docker_cli_exec_test.go b/integration-cli/docker_cli_exec_test.go index a3a6a23620..5bb2dc4bb7 100644 --- a/integration-cli/docker_cli_exec_test.go +++ b/integration-cli/docker_cli_exec_test.go @@ -367,3 +367,28 @@ func TestExecParseError(t *testing.T) { } logDone("exec - error on parseExec should return usage") } + +func TestExecStopNotHanging(t *testing.T) { + defer deleteAllContainers() + if out, err := exec.Command(dockerBinary, "run", "-d", "--name", "testing", "busybox", "top").CombinedOutput(); err != nil { + t.Fatal(out, err) + } + + if err := exec.Command(dockerBinary, "exec", "testing", "top").Start(); err != nil { + t.Fatal(err) + } + + wait := make(chan struct{}) + go func() { + if out, err := exec.Command(dockerBinary, "stop", "testing").CombinedOutput(); err != nil { + t.Fatal(out, err) + } + close(wait) + }() + select { + case <-time.After(3 * time.Second): + t.Fatal("Container stop timed out") + case <-wait: + } + logDone("exec - container with exec not hanging on stop") +}