read initial state from watchfile, should fix #17

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
Justin Cormack 2016-01-27 12:16:02 +00:00
parent 2388a191f3
commit 3891dc0aef

View File

@ -36,6 +36,11 @@ func main() {
} }
// 43 bytes is the record size of the watch // 43 bytes is the record size of the watch
buf := make([]byte, 43) buf := make([]byte, 43)
// initial state
_, err := watch.Read(buf)
if err != nil {
log.Fatalln("Error reading watch file", err)
}
for { for {
n, err := watch.Read(buf) n, err := watch.Read(buf)
if err != nil { if err != nil {