Stream CLI run output incrementally

This commit is contained in:
2026-04-04 17:58:57 +02:00
parent 46ba82bc55
commit fe6263d575

View File

@@ -315,9 +315,12 @@ proc runFile(config: CompilationConfig) =
maybeEcho(showInfo, &"Generated C LOC: {totalGeneratedLoc}")
maybeEcho(showInfo, &"Compilation time: {formatMilliseconds(compiled.elapsedMs)}")
if config.run:
let execution = runExecutable(compiled.executablePath)
if execution.output.len() > 0:
stdout.write(execution.output)
let execution = runExecutableStreaming(
compiled.executablePath,
onChunk = proc (chunk: string) =
stdout.write(chunk)
stdout.flushFile()
)
if execution.exitCode != 0:
quit(execution.exitCode)
except LexingError as exc: