mirror of
https://git.asonix.dog/asonix/pict-rs
synced 2024-11-09 22:14:59 +00:00
Add warn logs when performing blocking removes due to dropped files
This commit is contained in:
parent
6fa79b9188
commit
89a4e3995f
1 changed files with 10 additions and 3 deletions
|
@ -57,7 +57,8 @@ impl TmpDir {
|
|||
|
||||
impl Drop for TmpDir {
|
||||
fn drop(&mut self) {
|
||||
if let Some(path) = self.path.as_ref() {
|
||||
if let Some(path) = self.path.take() {
|
||||
tracing::warn!("TmpDir - Blocking remove of {path:?}");
|
||||
std::fs::remove_dir_all(path).expect("Removed directory");
|
||||
}
|
||||
}
|
||||
|
@ -98,7 +99,10 @@ impl Deref for TmpFolder {
|
|||
impl Drop for TmpFolder {
|
||||
fn drop(&mut self) {
|
||||
if let Some(path) = self.0.take() {
|
||||
let _ = std::fs::remove_dir_all(path);
|
||||
tracing::warn!("TmpFolder - Blocking remove of directory {path:?}");
|
||||
if let Err(e) = std::fs::remove_dir_all(path) {
|
||||
tracing::error!("Failed removing directory {e}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -138,7 +142,10 @@ impl Deref for TmpFile {
|
|||
impl Drop for TmpFile {
|
||||
fn drop(&mut self) {
|
||||
if let Some(path) = self.0.take() {
|
||||
let _ = std::fs::remove_file(path);
|
||||
tracing::warn!("TmpFile - Blocking remove of file {path:?}");
|
||||
if let Err(e) = std::fs::remove_file(path) {
|
||||
tracing::error!("Failed removing file {e}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue