1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-24 08:09:08 -05:00

fix(watch): don't panic if there's no path provided (#26972)

Closes https://github.com/denoland/deno/issues/26970
This commit is contained in:
Bartek Iwańczuk 2024-11-21 16:29:40 +00:00 committed by David Sherret
parent 5f787957b1
commit 984a87fad5

View file

@ -185,9 +185,11 @@ impl WatcherCommunicator {
pub fn show_path_changed(&self, changed_paths: Option<Vec<PathBuf>>) {
if let Some(paths) = changed_paths {
self.print(
format!("Restarting! File change detected: {:?}", paths[0]).to_string(),
)
if !paths.is_empty() {
self.print(format!("Restarting! File change detected: {:?}", paths[0]))
} else {
self.print("Restarting! File change detected.".to_string())
}
}
}
}