]> go.fuhry.dev Git - fsnotify.git/commitdiff
Don't watch named pipes
authorEvan Phoenix <evan@fallingsnow.net>
Wed, 14 Oct 2015 17:50:51 +0000 (10:50 -0700)
committerNathan Youngman <git@nathany.com>
Wed, 14 Oct 2015 22:24:13 +0000 (16:24 -0600)
You can't watch a named pipe, same as a socket. The call to `Open` will just hang forever.

closes #98

CHANGELOG.md
kqueue.go

index ea9428a2a49ddf50ec7a5364c93efc1618bdd27f..9b52489146b55202131688f07a0fb1a9c0d93c10 100644 (file)
@@ -1,5 +1,9 @@
 # Changelog
 
+## master
+
+* kqueue: don't watch named pipes [#98](https://github.com/go-fsnotify/fsnotify/pull/98) (thanks @evanphx)
+
 ## v1.2.0 / 2015-02-08
 
 * inotify: use epoll to wake up readEvents [#66](https://github.com/go-fsnotify/fsnotify/pull/66) (thanks @PieterD)
index 265622d201df9850805360d064690b9237191888..f8a364df9cfcb78830f330336604ff15c664f6a0 100644 (file)
--- a/kqueue.go
+++ b/kqueue.go
@@ -181,6 +181,11 @@ func (w *Watcher) addWatch(name string, flags uint32) error {
                        return nil
                }
 
+               // Don't watch named pipes.
+               if fi.Mode()&os.ModeNamedPipe == os.ModeNamedPipe {
+                       return nil
+               }
+
                // Follow Symlinks
                // Unfortunately, Linux can add bogus symlinks to watch list without
                // issue, and Windows can't do symlinks period (AFAIK). To  maintain