瀏覽代碼

testutil/daemon: ReadLogFile() trigger os.Sync() before reading

Make sure it's written to disk before we try reading the logs.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 3 年之前
父節點
當前提交
e7583ab859
共有 1 個文件被更改,包括 1 次插入0 次删除
  1. 1 0
      testutil/daemon/daemon.go

+ 1 - 0
testutil/daemon/daemon.go

@@ -262,6 +262,7 @@ func (d *Daemon) LogFileName() string {
 
 
 // ReadLogFile returns the content of the daemon log file
 // ReadLogFile returns the content of the daemon log file
 func (d *Daemon) ReadLogFile() ([]byte, error) {
 func (d *Daemon) ReadLogFile() ([]byte, error) {
+	_ = d.logFile.Sync()
 	return os.ReadFile(d.logFile.Name())
 	return os.ReadFile(d.logFile.Name())
 }
 }