Fix opts.no_cleanup behavior

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-07-19 00:39:27 +10:00
parent b223990bb1
commit c6281d8ea0
No known key found for this signature in database
GPG key ID: 591C0B03040416D6

View file

@ -319,7 +319,10 @@ async fn entry() -> Result<()> {
await_task(task).await?;
}
if !opts.no_cleanup {
if opts.no_cleanup {
// Consume temp_dir without removing it from fs.
temp_dir.into_path();
} else {
temp_dir.close().unwrap_or_else(|err| {
warn!("Failed to clean up some resources: {err}");
});