Merge pull request #117 from shaunbennett/master

Watch for file creation events in watch mode
pull/119/head
komaeda 5 years ago committed by GitHub
commit 7d6e2812fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3,6 +3,7 @@ use crate::verify::verify;
use clap::{crate_version, App, Arg, SubCommand};
use notify::DebouncedEvent;
use notify::{RecommendedWatcher, RecursiveMode, Watcher};
use std::ffi::OsStr;
use std::io::BufRead;
use std::sync::mpsc::channel;
use std::time::Duration;
@ -85,8 +86,10 @@ fn watch() -> notify::Result<()> {
loop {
match rx.recv() {
Ok(event) => match event {
DebouncedEvent::Chmod(_) | DebouncedEvent::Write(_) => {
let _ignored = verify();
DebouncedEvent::Create(b) | DebouncedEvent::Chmod(b) | DebouncedEvent::Write(b) => {
if b.extension() == Some(OsStr::new("rs")) {
let _ignored = verify();
}
}
_ => {}
},

Loading…
Cancel
Save