mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-27 00:00:03 +03:00
Auto merge of #191 - MrFroop:master, r=komaeda
Fix(watch): Check if changed exercise file exists before calling verify. Prevent a panic if the file triggering the watch event is gone.
This commit is contained in:
commit
7dc90094d2
|
@ -101,7 +101,7 @@ fn watch(exercises: &[Exercise]) -> notify::Result<()> {
|
||||||
match rx.recv() {
|
match rx.recv() {
|
||||||
Ok(event) => match event {
|
Ok(event) => match event {
|
||||||
DebouncedEvent::Create(b) | DebouncedEvent::Chmod(b) | DebouncedEvent::Write(b) => {
|
DebouncedEvent::Create(b) | DebouncedEvent::Chmod(b) | DebouncedEvent::Write(b) => {
|
||||||
if b.extension() == Some(OsStr::new("rs")) {
|
if b.extension() == Some(OsStr::new("rs")) && b.exists() {
|
||||||
println!("----------**********----------\n");
|
println!("----------**********----------\n");
|
||||||
let filepath = b.as_path().canonicalize().unwrap();
|
let filepath = b.as_path().canonicalize().unwrap();
|
||||||
let exercise = exercises
|
let exercise = exercises
|
||||||
|
|
Loading…
Reference in a new issue