소스 검색

Merge pull request #39197 from djsweet/log-daemon-exit-before-tests-finish

Ensure all integration daemon logging happens before test exit
Sebastiaan van Stijn 6 년 전
부모
커밋
3998dffb80
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      internal/test/daemon/daemon.go

+ 4 - 1
internal/test/daemon/daemon.go

@@ -271,8 +271,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)
 	}()