Skip to content
This repository was archived by the owner on May 28, 2023. It is now read-only.

Add Windows support using Powershell and winfsnotify #13

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

enmand
Copy link
Contributor

@enmand enmand commented Feb 8, 2016

This PR adds support for Windows.

There are a few requirements:

  • rsync.exe and ssh.exe must be in your path. This PR has been tested with cwrsync
  • You must have powershell.exe available

There is some wonkiness with winfsnotify -- in the future it may be worth to use https://godoc.org/gopkg.in/fsnotify.v1 instead (which would also allow for Linux support to be implemented).

@blaggacao
Copy link

That's cool!

@mattes
Copy link
Contributor

mattes commented Apr 19, 2016

Someone wants to remove the merge conflicts? :-)

@tchap
Copy link

tchap commented May 12, 2016

But isn't https://github.com/fsnotify/fsnotify already supporting all operating systems needed? From README I can see that there is inotify, kqueue and ReadDirectoryChangesW ...

@enmand
Copy link
Contributor Author

enmand commented May 12, 2016

@tchap There are some issues with fsnotify on Windows that preclude it from use in the environment (at least when I was researching for this issue -- things change quick in our software dev. world :))

From https://docs.google.com/document/d/1-GQrFdDVrA57-ce0kbzSth4lQqfOMMRKpih3hPJmvoU/edit#, file change operations are an issue on Windows with fsnotify:

However, there is room for efficiency gains, by only asking the kernel watch for and report on Ops that the program is interested in. Sadly Windows doesn’t have separate filtering options for Create, Remove and Rename.

Is this efficiency worth gaining?
What are the file operations that users are most interested in?
To achieve consistent behavior on Windows, is it worth adding internal complexity of a single user-space filter?
...

Additionally, ReadDirectoryChangesW is a non-recursive watcher,

Windows has a bWatchSubtree option and FSEvents is a recursive-only watcher. Not exposing a recursive watcher means user code or third-party libraries will need to provide a user-space recursive watcher, even on Windows.

These deficiencies were enough to use winfsnotify instead of fsnotify for Windows support, to properly support this on Windows, without writing a bunch of additional code to properly decipher file events, or manually add recursive watchers manually.

@mattes -- I'll take a look at cleaning up for merge this week!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants