Merge pull request #246 from thaJeztah/18.09_backport_log-daemon-exit-before-tests-finish

[18.09 backport] Ensure all integration daemon logging happens before test exit
Upstream-commit: 08f6e9c14fd0de408db93914058d75df5b32ac67
Component: engine
This commit is contained in:
Andrew Hsu
2019-06-17 12:15:43 -07:00
committed by GitHub
@@ -268,8 +268,11 @@ func (d *Daemon) StartWithLogFile(out *os.File, providedArgs ...string) error {
wait := make(chan error)
go func() {
wait <- d.cmd.Wait()
ret := d.cmd.Wait()
d.log.Logf("[%s] exiting daemon", d.id)
// If we send before logging, we might accidentally log _after_ the test is done.
// As of Go 1.12, this incurs a panic instead of silently being dropped.
wait <- ret
close(wait)
}()