From 989c7bda956ea0e5bea1ee91605c6e762a2b0947 Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Wed, 4 Sep 2024 14:19:19 +0000 Subject: [PATCH] [REPL] prevent silent hang if precompile script async blocks fail --- stdlib/REPL/src/precompile.jl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/stdlib/REPL/src/precompile.jl b/stdlib/REPL/src/precompile.jl index a6effb9f013fc2..82a1a0bb78ee89 100644 --- a/stdlib/REPL/src/precompile.jl +++ b/stdlib/REPL/src/precompile.jl @@ -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 @@ -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) @@ -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