Skip to content

Commit

Permalink
kill precompilation process if it is too slow (#301)
Browse files Browse the repository at this point in the history
some users have reported OhMyREPL getting stuck precompiling, this should fix this in a non-idea way
  • Loading branch information
KristofferC authored Mar 10, 2023
1 parent f2ee4ad commit 9fcf82d
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/OhMyREPL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,22 @@ OhMyREPL.TerminalRegressionTests.create_automated_test(
end
"""

p = run(pipeline(ignorestatus(`$(Base.julia_cmd()) --project=$(Base.active_project()) --trace-compile=$tracecompile_file --compiled-modules=no -e $content`); stderr=devnull))
if p.exitcode != 0
# There seems to be some finalizer problem from VT100...
# @warn "OhMyREPL internal precompilation failed"
function run_with_timeout(command, timeout::Integer = 25)
cmd = run(command; wait=false)
for _ in 1:timeout
if !process_running(cmd) return success(cmd) end
sleep(1)
end
@warn "OhMyREPL precompilation not finished in time, killing"
kill(cmd)
return false
end


run_with_timeout(
pipeline(ignorestatus(`$(Base.julia_cmd()) --project=$(Base.active_project()) --trace-compile=$tracecompile_file --compiled-modules=no -e $content`); stderr=devnull)
)

num_prec = 0
for line in eachline(tracecompile_file)
try
Expand Down

0 comments on commit 9fcf82d

Please sign in to comment.