Skip to content

Commit

Permalink
When adding using Revise to startup.jl, guard with try-catch
Browse files Browse the repository at this point in the history
  • Loading branch information
johnomotani committed Apr 30, 2024
1 parent 7015ee8 commit bcfd62a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion machines/shared/machine_setup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,15 @@ function machine_setup_moment_kinetics(machine::String; no_force_exit::Bool=fals
result = run(`grep "using Revise" $startup_path`, wait=false)
if !success(result)
println("Adding `using Revise` to $startup_path")
# When initialising a new copy of the repo, if Revise is not installed yet
# having just `using Revise` in the startup.jl would cause an error, so
# guard it with a try/catch.
open(startup_path, "a") do io
println(io, "\nusing Revise")
println(io, "\ntry")
println(io, " using Revise")
println(io, "catch")
println(io, " println(\"Warning: failed to load Revise\")")
println(io, "end")
end
end
end
Expand Down

0 comments on commit bcfd62a

Please sign in to comment.