From adcb2e389de8d0e0b3dd782c0b2cef0c4d1371bf Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Fri, 12 Oct 2012 17:30:45 -0700 Subject: [PATCH] fix: BlockUntilExists should only return if filename matches --- watch.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/watch.go b/watch.go index bc90829..57bd609 100644 --- a/watch.go +++ b/watch.go @@ -36,7 +36,12 @@ func (fw *InotifyFileWatcher) BlockUntilExists() error { return err } defer w.RemoveWatch(filepath.Dir(fw.Filename)) - <-w.Event + for { + evt := <-w.Event + if evt.Name == fw.Filename { + break + } + } return nil }