@@ -231,6 +231,11 @@ if Profile !== nothing
231
231
"""
232
232
end
233
233
234
+ const JULIA_PROMPT = " julia> "
235
+ const PKG_PROMPT = " pkg> "
236
+ const SHELL_PROMPT = " shell> "
237
+ const HELP_PROMPT = " help?> "
238
+
234
239
function generate_precompile_statements ()
235
240
start_time = time_ns ()
236
241
debug_output = devnull # or stdout
@@ -311,7 +316,7 @@ function generate_precompile_statements()
311
316
close (ptm)
312
317
end
313
318
# wait for the definitive prompt before start writing to the TTY
314
- readuntil (output_copy, " julia> " )
319
+ readuntil (output_copy, JULIA_PROMPT )
315
320
sleep (0.1 )
316
321
readavailable (output_copy)
317
322
# Input our script
@@ -329,9 +334,16 @@ function generate_precompile_statements()
329
334
write (ptm, l, " \n " )
330
335
readuntil (output_copy, " \n " )
331
336
# wait for the next prompt-like to appear
332
- # NOTE: this is rather inaccurate because the Pkg REPL mode is a special flower
333
337
readuntil (output_copy, " \n " )
334
- readuntil (output_copy, " > " )
338
+ strbuf = " "
339
+ while true
340
+ strbuf *= String (readavailable (output_copy))
341
+ occursin (JULIA_PROMPT, strbuf) && break
342
+ occursin (PKG_PROMPT, strbuf) && break
343
+ occursin (SHELL_PROMPT, strbuf) && break
344
+ occursin (HELP_PROMPT, strbuf) && break
345
+ sleep (0.1 )
346
+ end
335
347
end
336
348
println ()
337
349
end
0 commit comments