ffi issue-0047: #run print output now routes to stdout
`#run` / post-link callback `print` output was reaching stderr via `std.debug.print` flushes from three sites. The runtime JIT path already writes to fd 1 (stdout) directly. Anyone redirecting one stream saw the two halves disappear in different places. Switches all three flush sites + the `--- build done ---` delimiter in main.zig to `std.c.write(1, ...)` so build-time and runtime prints share the stream the user wrote them against (they typed the same `print(...)` at both call sites — there's no reason for them to land on different streams). Test runner uses `2>&1` so snapshots are unaffected; suite stays at 218/218. Closes issue-0047.
This commit is contained in:
@@ -1128,9 +1128,11 @@ pub const LLVMEmitter = struct {
|
||||
var interp_inst = Interpreter.init(self.ir_mod, self.alloc);
|
||||
interp_inst.build_config = &self.build_config;
|
||||
_ = interp_inst.call(func_id, &.{}) catch {};
|
||||
// Write comptime output to stderr (same as old comptime VM)
|
||||
// Route #run `print` output to fd 1 so it joins the
|
||||
// JIT-executed runtime's stream. Same call site shape as
|
||||
// `core.flushInterpOutput` — see issue-0047.
|
||||
if (interp_inst.output.items.len > 0) {
|
||||
std.debug.print("{s}", .{interp_inst.output.items});
|
||||
_ = std.c.write(1, interp_inst.output.items.ptr, interp_inst.output.items.len);
|
||||
}
|
||||
interp_inst.deinit();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user