@@ -397,18 +397,25 @@ async fn download_package_manager(
397397 // Another concurrent process created the directory - that's OK
398398 tracing:: debug!( "Target directory already exists (concurrent creation), using it" ) ;
399399 // Clean up the temporary directory we don't need anymore
400- let _ = remove_dir_all ( & target_dir_tmp) . await ;
400+ if let Err ( cleanup_err) = remove_dir_all ( & target_dir_tmp) . await {
401+ tracing:: warn!(
402+ "Failed to clean up temporary directory {:?}: {}" ,
403+ target_dir_tmp,
404+ cleanup_err
405+ ) ;
406+ }
401407 Ok ( install_dir)
402408 }
403409 Err ( e) => Err ( e. into ( ) ) ,
404410 }
405411}
406412
407413// OS-specific error codes for concurrent file system operations
408- const ENOTEMPTY_UNIX : i32 = 39 ; // Directory not empty on some Unix systems
409- const ENOTEMPTY_MACOS : i32 = 66 ; // Directory not empty on macOS
414+ // Note: ENOTEMPTY varies by Unix flavor - Linux uses 39, macOS/BSD use 66
415+ const ENOTEMPTY_LINUX : i32 = 39 ; // Directory not empty on Linux
416+ const ENOTEMPTY_BSD : i32 = 66 ; // Directory not empty on macOS/BSD
410417const ERROR_DIR_NOT_EMPTY_WINDOWS : i32 = 145 ; // Directory not empty on Windows
411- const EEXIST_UNIX : i32 = 17 ; // File exists on Unix
418+ const EEXIST_UNIX : i32 = 17 ; // File exists on Unix (both Linux and macOS)
412419const ERROR_ALREADY_EXISTS_WINDOWS : i32 = 183 ; // File/directory already exists on Windows
413420
414421/// Remove the directory and all its contents.
@@ -423,7 +430,7 @@ async fn remove_dir_all_force(path: impl AsRef<Path>) -> Result<(), std::io::Err
423430 if e. kind ( ) == std:: io:: ErrorKind :: NotFound
424431 || matches ! (
425432 e. raw_os_error( ) ,
426- Some ( ENOTEMPTY_UNIX ) | Some ( ENOTEMPTY_MACOS ) | Some ( ERROR_DIR_NOT_EMPTY_WINDOWS )
433+ Some ( ENOTEMPTY_LINUX ) | Some ( ENOTEMPTY_BSD ) | Some ( ERROR_DIR_NOT_EMPTY_WINDOWS )
427434 )
428435 {
429436 tracing:: debug!( "Ignoring directory removal error (likely concurrent access): {}" , e) ;
0 commit comments