Skip to content

prevent confusing debugging experience when users write garbage to stdout, interfering with the build runner / test runner protocol #15091

@gitusel

Description

@gitusel

Zig Version

0.11.0-dev.2297+28d6dd75a

Steps to Reproduce and Observed Behavior

1/ zig init-lib
2/ Correct test_step.dependOn(&main_tests.step); to test_step.dependOn(&main_tests.run().step);
3/ src/main.zig
const std = @import("std");
test "t" {
const writer = std.io.getStdOut().writer();
var buffered_writer = std.io.bufferedWriter(writer);
var stdout_writer = buffered_writer.writer();
stdout_writer.print("TEST: t\n", .{}) catch @Panic("PANIC!\n");
buffered_writer.flush() catch @Panic("PANIC!\n");
}

4/ run zig build test. The test stalled and you need to exit using ctrl+c.

Expected Behavior

The test should run and exit.

If using stdErr, e.g. changing const writer = std.io.getStdOut().writer(); to const writer = std.io.getStdErr().writer(); will make it passed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementSolving this issue will likely involve adding new logic or components to the codebase.zig build systemstd.Build, the build runner, `zig build` subcommand, package management

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions