File tree Expand file tree Collapse file tree 1 file changed +17
-6
lines changed
Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -767,18 +767,29 @@ pub fn garbage_collect_versions(
767767 version : _,
768768 } => true ,
769769 } ) {
770- let path_to_delete = paths. juliauphome . join ( & detail. path ) ;
770+ let path_to_delete = paths. juliauphome . join ( & detail. path ) . canonicalize ( ) ? ;
771771 let display = path_to_delete. display ( ) ;
772772
773- if std:: fs:: remove_dir_all ( & path_to_delete) . is_err ( ) {
774- eprintln ! ( "WARNING: Failed to delete {}. You can try to delete at a later point by running `juliaup gc`." , display)
773+ match std:: fs:: remove_dir_all ( & path_to_delete) {
774+ Ok ( _) => versions_to_uninstall. push ( installed_version. clone ( ) ) ,
775+ Err ( _) => eprintln ! (
776+ "{}: Failed to delete {}. \
777+ Make sure to close any old julia version still running.\n \
778+ You can try to delete at a later point by running `juliaup gc`.",
779+ style( "WARNING" ) . yellow( ) . bold( ) ,
780+ display
781+ ) ,
775782 }
776- versions_to_uninstall. push ( installed_version. clone ( ) ) ;
777783 }
778784 }
779785
780- for i in versions_to_uninstall {
781- config_data. installed_versions . remove ( & i) ;
786+ if versions_to_uninstall. is_empty ( ) {
787+ eprintln ! ( "Nothing to remove." ) ;
788+ } else {
789+ for i in versions_to_uninstall {
790+ eprintln ! ( "{} Julia {}" , style( "Removed" ) . green( ) . bold( ) , & i) ;
791+ config_data. installed_versions . remove ( & i) ;
792+ }
782793 }
783794
784795 if prune_linked {
You can’t perform that action at this time.
0 commit comments