mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 02:48:24 +00:00
fix(watch): ignore unload errors on drop (#15782)
This commit is contained in:
parent
d20e80fa50
commit
118dd47ad0
3 changed files with 48 additions and 10 deletions
|
@ -125,13 +125,18 @@ impl CliMainWorker {
|
|||
self.pending_unload = true;
|
||||
|
||||
let result = loop {
|
||||
let result = self.inner.worker.run_event_loop(false).await;
|
||||
if !self
|
||||
match self.inner.worker.run_event_loop(false).await {
|
||||
Ok(()) => {}
|
||||
Err(error) => break Err(error),
|
||||
}
|
||||
match self
|
||||
.inner
|
||||
.worker
|
||||
.dispatch_beforeunload_event(&located_script_name!())?
|
||||
.dispatch_beforeunload_event(&located_script_name!())
|
||||
{
|
||||
break result;
|
||||
Ok(default_prevented) if default_prevented => {} // continue loop
|
||||
Ok(_) => break Ok(()),
|
||||
Err(error) => break Err(error),
|
||||
}
|
||||
};
|
||||
self.pending_unload = false;
|
||||
|
@ -152,11 +157,10 @@ impl CliMainWorker {
|
|||
impl Drop for FileWatcherModuleExecutor {
|
||||
fn drop(&mut self) {
|
||||
if self.pending_unload {
|
||||
self
|
||||
let _ = self
|
||||
.inner
|
||||
.worker
|
||||
.dispatch_unload_event(&located_script_name!())
|
||||
.unwrap();
|
||||
.dispatch_unload_event(&located_script_name!());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue