diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-21 11:08:50 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-21 11:08:50 +0000 |
| commit | 7b94b9003daa1126ce78df37481fc52774c2f0b4 (patch) | |
| tree | c5e491c2a33d031da2f3400143ec74dab437e291 /tools/driver | |
| parent | 5a254e2ab4741bc88c373ae1673c2ad9a7e6a588 (diff) | |
feat(bundle): run the bundled compiler with input and streaming output
Save before running, close prefilled stdin at EOF, and stream output bytes
through Tauri channels. Stop and reap the child before exit or another run.
Disable embedded stdout buffering and exercise the runner with real programs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tools/driver')
| -rw-r--r-- | tools/driver/EmbeddedRunner.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/driver/EmbeddedRunner.cc b/tools/driver/EmbeddedRunner.cc index 587d664..2833cfd 100644 --- a/tools/driver/EmbeddedRunner.cc +++ b/tools/driver/EmbeddedRunner.cc @@ -191,6 +191,12 @@ static llvm::Error loadCxxRuntime(llvm::orc::LLJIT &J) { } int runEmbedded(const cps::CodeGen &CG, const std::vector<std::string> &Objects) { + // Pipes are fully buffered by default. Use the host CRT's stdout, also + // preferred by the JIT on Windows, so OUTPUT reaches desktop clients now. + if (std::setvbuf(stdout, nullptr, _IONBF, 0) != 0) { + llvm::errs() << "error: cannot configure embedded stdout\n"; + return 1; + } if (llvm::InitializeNativeTarget() || llvm::InitializeNativeTargetAsmPrinter()) { llvm::errs() << "error: cannot initialize the embedded LLVM target\n"; return 1; |
