[19.03 backport] Ensure all integration daemon logging happens before test exit
| ... | ... |
@@ -271,8 +271,11 @@ func (d *Daemon) StartWithLogFile(out *os.File, providedArgs ...string) error {
|
| 271 | 271 |
wait := make(chan error) |
| 272 | 272 |
|
| 273 | 273 |
go func() {
|
| 274 |
- wait <- d.cmd.Wait() |
|
| 274 |
+ ret := d.cmd.Wait() |
|
| 275 | 275 |
d.log.Logf("[%s] exiting daemon", d.id)
|
| 276 |
+ // If we send before logging, we might accidentally log _after_ the test is done. |
|
| 277 |
+ // As of Go 1.12, this incurs a panic instead of silently being dropped. |
|
| 278 |
+ wait <- ret |
|
| 276 | 279 |
close(wait) |
| 277 | 280 |
}() |
| 278 | 281 |
|