Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross-platfrom file watching support #12

Closed
mre opened this issue Apr 8, 2019 · 14 comments
Closed

Cross-platfrom file watching support #12

mre opened this issue Apr 8, 2019 · 14 comments
Assignees
Labels
enhancement New feature or request

Comments

@mre
Copy link

mre commented Apr 8, 2019

On macOS, compilation currently fails with the following error message:

  Compiling hunter v1.0.1 (/Users/mendler/Code/upstream/hunter)
error[E0432]: unresolved import `notify::INotifyWatcher`
 --> src/fscache.rs:1:14
  |
1 | use notify::{INotifyWatcher, Watcher, DebouncedEvent, RecursiveMode};
  |              ^^^^^^^^^^^^^^ no `INotifyWatcher` in the root

That's because inotifywatch is Linux-specific.
I recommend https://github.com/passcod/notify for cross-platform filesystem notifications.

@rabite0
Copy link
Owner

rabite0 commented Apr 8, 2019

Is that the only blocking issue for OSX? Hard to say I guess.

Should be an easy fix, that's the library I'm actually already using, so this would be a small change. Will look into that. Thanks for reporting.

@rabite0 rabite0 self-assigned this Apr 8, 2019
@rabite0 rabite0 added the enhancement New feature or request label Apr 8, 2019
@mre
Copy link
Author

mre commented Apr 8, 2019

Yeah from what I can tell, it should be the only issue. The other crates either explicitly mention macOS support or they are platform-independent.

@dmilith
Copy link

dmilith commented Apr 11, 2019

@dmilith
Copy link

dmilith commented Apr 11, 2019

To make a long story short - "inotify" (but also epoll) are Linux only "techno-logies", so using Linux only stuff will limit usability of the project on other platforms :)

@rabite0
Copy link
Owner

rabite0 commented Apr 11, 2019

Yeah, this also prevents it from working on BSD systems. Ironically it works nicely on Windows (with WSL)...
The crate I use is already cross-platform, I just failed to use it that way, so this shouldn't take much work. Will fix this in the next few days.

@rabite0
Copy link
Owner

rabite0 commented Apr 11, 2019

Ok, so I did take a look and it was even easier to fix than I thought, just needed to replace InotifyWatcher with RecommendedWatcher at three points.

There are likely to be issues with how those notifications are handled/issued at the OS level due to differences between systems and I will take a look into that later, but it should at least compile and run now.

EDIT: From what I can see the only issues that might arise affect all platforms since I was lazy, so if it runs this is more or less solved.

@berkus
Copy link

berkus commented Apr 11, 2019

Yeah, please do! Jumping wanna try it on macOS.

@rabite0
Copy link
Owner

rabite0 commented Apr 11, 2019

I already did, it's in the master branch. :) Just waiting for someone to report success before I close the issue.

@davidpdrsn
Copy link

It isn't working for me. It builds successfully crashes on launch

Screenshot 2019-04-11 at 15 54 09

I installed libmagic with brew reinstall libmagic. macOS 10.14.3, running in tmux.

@rabite0
Copy link
Owner

rabite0 commented Apr 11, 2019

From the looks of it, this is caused by the metadata-fetching, maybe related to the thread-pool somehow. Will investigate further, thanks for testing.

Closing this issue since this crash has nothing to do with file watching.

@rabite0
Copy link
Owner

rabite0 commented Apr 13, 2019

See : #17

Please test if it works.

@berkus
Copy link

berkus commented Apr 17, 2019

Cool, it builds, but crashes immediately on startup. Will open a new ticket.

Ah, wait, I see you did something in #17 but the version from crates.io still crashes. Was there a release with fix yet?

@rabite0
Copy link
Owner

rabite0 commented Apr 17, 2019

It seemed to be fine from the reports I got, but apparently not. :(

Please open a new issue and include a stack trace if you can. It's probably rather an issue with a file it tries to load, rather than something that has to do with macOS. Since I added the panic-handler it should print it fine when it crashes.

You could try to open it in different directories and see if it starts up.

@berkus
Copy link

berkus commented May 6, 2019

Hi!
Not opening a new issue, because version 1.1.0 works fine on my mac! 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants