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:
@@ -290,7 +290,14 @@ pub fn main(init: std.process.Init) !void {
|
||||
// run-time output ambiguously. Only when top-level #run exists —
|
||||
// pure-runtime tests keep their current snapshots.
|
||||
if (hasTopLevelRun(root)) {
|
||||
std.debug.print("--- build done ---\n", .{});
|
||||
// Stay on the same stream as the #run output (stdout, via
|
||||
// core.flushInterpOutput). Same reason as issue-0047: the
|
||||
// user doesn't distinguish build-time `print` from
|
||||
// runtime `print` at the call site, and the delimiter is
|
||||
// meaningless if it lands on a different stream than the
|
||||
// output it's separating.
|
||||
const marker = "--- build done ---\n";
|
||||
_ = std.c.write(1, marker.ptr, marker.len);
|
||||
}
|
||||
const exit_code = sx.target.runJITFromObject(obj_buf) catch {
|
||||
// JIT failed — fall back to AOT
|
||||
|
||||
Reference in New Issue
Block a user