mirror of
https://git.asonix.dog/asonix/pict-rs
synced 2024-12-22 19:31:35 +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 {
|
impl Drop for TmpDir {
|
||||||
fn drop(&mut self) {
|
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");
|
std::fs::remove_dir_all(path).expect("Removed directory");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,7 +99,10 @@ impl Deref for TmpFolder {
|
||||||
impl Drop for TmpFolder {
|
impl Drop for TmpFolder {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
if let Some(path) = self.0.take() {
|
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 {
|
impl Drop for TmpFile {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
if let Some(path) = self.0.take() {
|
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