-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check for errors from
str_path_to_cfstring_ref
.
Closes #301.
- Loading branch information
1 parent
4a3f5a3
commit 86421e5
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use std::{env, fs, thread, time::Duration}; | ||
|
||
use notify::{immediate_watcher, RecursiveMode, Watcher}; | ||
|
||
/// Test for <https://github.com/notify-rs/notify/issues/301>. | ||
/// Note: This test will fail if your temp directory is not writable. | ||
#[test] | ||
fn test_race_with_remove_dir() { | ||
let tmpdir = env::temp_dir().join(".tmprPcUcB"); | ||
fs::create_dir_all(&tmpdir).unwrap(); | ||
|
||
{ | ||
let tmpdir = tmpdir.clone(); | ||
thread::spawn(move || { | ||
let mut watcher = immediate_watcher(move |result| { | ||
eprintln!("received event: {:?}", result); | ||
}) | ||
.unwrap(); | ||
|
||
watcher.watch(tmpdir, RecursiveMode::NonRecursive).unwrap(); | ||
}); | ||
} | ||
|
||
let subdir = tmpdir.join("146d921d.tmp"); | ||
fs::create_dir_all(&subdir).unwrap(); | ||
fs::remove_dir_all(&tmpdir).unwrap(); | ||
thread::sleep(Duration::from_secs(1)); | ||
} |