container: move channel close to its writer

let the writer of the channel close it.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano
2019-05-20 19:40:59 +02:00
parent 57e781462c
commit f86bb561ef

View File

@ -289,8 +289,8 @@ func (c *Container) Exec(tty, privileged bool, env, cmd []string, user, workDir
chWait := make(chan error)
go func() {
chWait <- execCmd.Wait()
close(chWait)
}()
defer close(chWait)
pidFile := c.execPidPath(sessionID)
// 60 second seems a reasonable time to wait