Skip to content

Commit

Permalink
Merge pull request #73 from JuliaLang/fix-remove
Browse files Browse the repository at this point in the history
Add gc command and make rm more robust
  • Loading branch information
davidanthoff authored Jul 18, 2021
2 parents 3bb47b4 + 9c844d1 commit cead281
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Juliaup/src/Juliaup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,13 @@ function garbage_collect_versions(config_data::Dict{String,Any})
end

for i in versions_to_uninstall
path_to_delete = joinpath(get_juliauphome_path(), i[2]["Path"])
try
path_to_delete = joinpath(get_juliauphome_path(), i[2]["Path"])
rm(path_to_delete, force=true, recursive=true)

delete!(config_data["InstalledVersions"], i[1])
catch
println("WARNING: Failed to delete $path_to_delete.")
println("WARNING: Failed to delete $path_to_delete. You can try to delete at a later point by running `juliaup gc`.")
end
end
end
Expand Down Expand Up @@ -419,6 +419,13 @@ function real_main()
else
println("ERROR: The status command does not accept any additional arguments.")
end
elseif ARGS[1] == "gc"
if length(ARGS)==1
config_data = load_config_db()
garbage_collect_versions(config_data)
else
println("ERROR: The gc command accepts no additional argument.")
end
else
println("ERROR: '", ARGS[1], "' is not a recognized command.")
end
Expand Down

0 comments on commit cead281

Please sign in to comment.