Skip to content

Commit

Permalink
read precompile_file in real time
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth committed Dec 29, 2022
1 parent a1ee9af commit 5ee671a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions contrib/generate_precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ generate_precompile_statements() = try # Make sure `ansi_enablecursor` is printe
close(output_copy)
close(ptm)
end
repl_inputter = @async begin
# wait for the definitive prompt before start writing to the TTY
readuntil(output_copy, JULIA_PROMPT)
sleep(0.1)
Expand Down Expand Up @@ -424,12 +425,21 @@ generate_precompile_statements() = try # Make sure `ansi_enablecursor` is printe
success(p) || Base.pipeline_error(p)
close(ptm)
write(debug_output, "\n#### FINISHED ####\n")

end
n_step2 = 0
for statement in split(read(precompile_file, String), '\n')
open(precompile_file, "r") do io
while true
eof(io) && istaskdone(repl_inputter) && break
if bytesavailable(io) == 0
sleep(0.1)
continue
end
statement = readline(io) # this blocks so we can't wait on it
isempty(statement) && continue
push!(statements_step2, statement)
n_step2 += 1
end
end
close(statements_step2)
print_state("step2" => "F$n_step2")
return :ok
Expand Down

0 comments on commit 5ee671a

Please sign in to comment.