From 2335e3742c7e27bf111bab4c82a4e4d57b0edf6c Mon Sep 17 00:00:00 2001 From: Vincent Bernardoff Date: Mon, 31 Aug 2026 11:38:03 +0200 Subject: [PATCH] fix(repl): flush system command output System commands write directly to stdout, which is block-buffered when the REPL is driven over a pipe. Flush once at the shared command boundary so handler output and errors are visible before the REPL waits for more input. Co-Authored-By: GPT-5 --- src/app/repl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/app/repl.c b/src/app/repl.c index 1dd955b7..f344f837 100644 --- a/src/app/repl.c +++ b/src/app/repl.c @@ -920,6 +920,11 @@ static bool handle_command(ray_repl_t* repl, const char* str, size_t len) { ray_release(result); } + /* A piped REPL uses block-buffered stdout. Every command response is + * complete at this boundary, including output printed by handlers and + * errors printed above, so make it visible before waiting for more input. */ + fflush(stdout); + /* Track timeit echoing so the prompt reflects current state. */ repl->timeit = g_ray_profile.active; return true;