1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -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 GitHub
parent aa0ba6580e
commit bfa9230d3b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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())
}
}
}
}