✗
Failing This test is currently failing.
Failed: crash-134
Failure Output
🎯 Compiler coordination: Passes: 20 (flow-based: elaborate, analysis, emission) Code
// PINNED BUG (2026-07-02, surfaced by koru-libs docker lift): a koru-compiled
// proc that runs std.process.Child.run and reads result.term.Exited PANICS
// ("access of union field 'Exited' while field 'Signal' is active") when the
// child exits NONZERO with STDERR CONTENT. The identical Zig compiled directly
// with `zig run` (same Zig 0.15.2) returns term = .{ .Exited = 3 } correctly.
// Nonzero-exit-with-empty-output and zero-exit-with-content both work through
// koru; only the nonzero+stderr combination corrupts the Term union tag.
// Expected (correct) behavior: the failed branch fires and prints the stderr
// text. Today: runtime panic — this test is an honest red pinning the defect.
~import std/io
const std = @import("std");
~tor run-cmd { argv0: string }
| ok i32
| failed { code: i32, msg: string }
~proc run-cmd|zig {
const allocator = std.heap.page_allocator;
const result = std.process.Child.run(.{
.allocator = allocator,
.argv = &[_][]const u8{ argv0, "-c", "printf 'error message to stderr' 1>&2; exit 3" },
}) catch |err| {
return .{ .failed = .{ .code = -1, .msg = @errorName(err) } };
};
defer allocator.free(result.stdout);
defer allocator.free(result.stderr);
if (result.term.Exited != 0) {
return .{ .failed = .{ .code = @intCast(result.term.Exited), .msg = result.stderr } };
}
return .{ .ok = 0 };
}
~run-cmd(argv0: "sh")
| ok _ |> std/io:print.ln("ok")
| failed e |> std/io:print.ln(e.msg)
Actual
Segmentation fault at address 0x104d50000
???:?:?: 0x18f28f504 in ??? (libsystem_platform.dylib)
???:?:?: 0x104bfdd5f in _Io.Writer.writeAll (???)
???:?:?: 0x104c2d883 in _Io.Writer.alignBuffer (???)
???:?:?: 0x104c0f95f in _Io.Writer.alignBufferOptions (???)
???:?:?: 0x104c0dd2b in _Io.Writer.printValue__anon_7877 (???)
???:?:?: 0x104c0d1c7 in _Io.Writer.print__anon_3847 (???)
???:?:?: 0x104c8ee6b in _fmt.bufPrint__anon_19458 (???)
???:?:?: 0x104c8df6b in _output_emitted.main_module.flow0__struct_19274.__kw__anon_19279 (???)
???:?:?: 0x104c8d8cb in _output_emitted.main_module.flow0 (???)
???:?:?: 0x104c8d74f in _output_emitted.main (???)
???:?:?: 0x104c8d66b in _main (???)
???:?:?: 0x18eec7dff in ??? (???)
???:?:?: 0x0 in ??? (???)
Expected output
error message to stderr
Flows
flow ~run-cmd click a branch to expand · @labels scroll to their anchor
run-cmd (argv0: "sh")
Test Configuration
MUST_RUN