[lxc-devel] [lxd/master] client: Empty stdin channel on exec completion

stgraber on Github lxc-bot at linuxcontainers.org
Tue Feb 26 11:01:38 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 370 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190226/950126c4/attachment.bin>
-------------- next part --------------
From ece1de996f1c75f95d4a7f6867ec5fcb208d4bde Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Tue, 26 Feb 2019 11:49:05 +0100
Subject: [PATCH] client: Empty stdin channel on exec completion
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #5489

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 client/lxd_containers.go | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/client/lxd_containers.go b/client/lxd_containers.go
index 60c6d3c020..8e2aee0de1 100644
--- a/client/lxd_containers.go
+++ b/client/lxd_containers.go
@@ -806,6 +806,12 @@ func (r *ProtocolLXD) ExecContainer(containerName string, exec api.ContainerExec
 
 				if fds["0"] != "" {
 					args.Stdin.Close()
+
+					// Empty the stdin channel but don't block on it as
+					// stdin may be stuck in Read()
+					go func() {
+						<-dones[0]
+					}()
 				}
 
 				for _, conn := range conns {


More information about the lxc-devel mailing list