Stream CLI run output incrementally
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user