Skip to content

Commit

Permalink
[REPL] prevent silent hang if precompile script async blocks fail
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash committed Sep 4, 2024
1 parent 53d3ca9 commit 989c7bd
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions stdlib/REPL/src/precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ let
repltask = @task try
Base.run_std_repl(REPL, false, :yes, true)
finally
redirect_stderr(isopen(orig_stderr) ? orig_stderr : devnull)
redirect_stdin(isopen(orig_stdin) ? orig_stdin : devnull)
redirect_stdout(isopen(orig_stdout) ? orig_stdout : devnull)
close(pts)
end
Expand All @@ -106,14 +106,14 @@ let
redirect_stdin(pts)
redirect_stdout(pts)
redirect_stderr(pts)
REPL.print_qualified_access_warning(Base.Iterators, Base, :minimum) # trigger the warning while stderr is suppressed
try
schedule(repltask)
# wait for the definitive prompt before start writing to the TTY
readuntil(output_copy, JULIA_PROMPT)
REPL.print_qualified_access_warning(Base.Iterators, Base, :minimum) # trigger the warning while stderr is suppressed
finally
redirect_stderr(isopen(orig_stderr) ? orig_stderr : devnull)
end
schedule(repltask)
# wait for the definitive prompt before start writing to the TTY
readuntil(output_copy, JULIA_PROMPT)
write(debug_output, "\n#### REPL STARTED ####\n")
sleep(0.1)
readavailable(output_copy)
Expand Down Expand Up @@ -148,9 +148,9 @@ let
write(ptm, "$CTRL_D")
wait(repltask)
finally
close(pts)
redirect_stdin(isopen(orig_stdin) ? orig_stdin : devnull)
redirect_stdout(isopen(orig_stdout) ? orig_stdout : devnull)
close(pts)
end
wait(tee)
end
Expand Down

0 comments on commit 989c7bd

Please sign in to comment.