Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,3 @@ jobs:

- name: Check compilation
run: cargo check --all-targets --all-features

- name: Run tests
run: cargo test --all-features

31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,41 @@ In `cargo.toml`
fsevent = "*"
```


# Usage

cf examples/ folder.

# Contributing

Contributions are welcome! Here's how you can help:

## Reporting Issues

If you find a bug or have a feature request, please open an issue on GitHub with:
- A clear description of the problem or suggestion
- Steps to reproduce (for bugs)
- Expected vs actual behavior
- Your environment details (OS version, Rust version)

## Pull Requests

1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Make your changes
4. Run tests: `cargo test`
5. Run clippy: `cargo clippy`
6. Format your code: `cargo fmt`
7. Commit your changes (`git commit -m 'Add some amazing feature'`)
8. Push to your branch (`git push origin feature/amazing-feature`)
9. Open a Pull Request

Please ensure:
- All tests pass
- Code follows Rust style guidelines (enforced by `rustfmt`)
- New features include tests
- Documentation is updated if needed

# Contributors

- Mathieu Poumeyrol [kali](https://github.com/kali)
Expand Down
10 changes: 6 additions & 4 deletions examples/fsevent-async-demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ fn main() {
let duration = std::time::Duration::from_secs(1);
match receiver.recv_timeout(duration) {
Ok(val) => println!("{:?}", val),
Err(e) => match e {
std::sync::mpsc::RecvTimeoutError::Disconnected => break,
_ => {} // This is the case where nothing entered the channel buffer (no file mods).
},
// This is the case where nothing entered the channel buffer (no file mods).
Err(e) => {
if e == std::sync::mpsc::RecvTimeoutError::Disconnected {
break;
}
}
}
}

Expand Down
14 changes: 7 additions & 7 deletions tests/fsevent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,19 +229,16 @@ fn internal_validate_watch_single_file(run_async: bool) {
let mut file = OpenOptions::new()
.write(true)
.create(true)
.truncate(true)
.open(dst.as_path())
.unwrap();
file.write_all(b"create").unwrap();
file.flush().unwrap();
drop(file);

// Wait a bit then modify
thread::sleep(Duration::from_millis(100));
let mut file = OpenOptions::new()
.write(true)
.append(true)
.open(dst.as_path())
.unwrap();
let mut file = OpenOptions::new().append(true).open(dst.as_path()).unwrap();
file.write_all(b"foo").unwrap();
file.flush().unwrap();
});
Expand All @@ -252,7 +249,10 @@ fn internal_validate_watch_single_file(run_async: bool) {
receiver,
vec![(
dst.to_str().unwrap().to_string(),
StreamFlags::ITEM_MODIFIED | StreamFlags::ITEM_CREATED | StreamFlags::ITEM_XATTR_MOD | StreamFlags::IS_FILE,
StreamFlags::ITEM_MODIFIED
| StreamFlags::ITEM_CREATED
| StreamFlags::ITEM_XATTR_MOD
| StreamFlags::IS_FILE,
)],
);

Expand Down