ziglang / zig

General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.
https://ziglang.org
MIT License
35.17k stars 2.57k forks source link

bw.flush(); will cause 'zig build test' hang #21984

Closed PegasusPlusUS closed 1 week ago

PegasusPlusUS commented 2 weeks ago

Zig Version

0.13.0

Steps to Reproduce and Observed Behavior

  1. Use 'zig init' to generate default project
  2. Append a test to src/main.zig:
    test "bw.flush() has to be commentted out" {
    try main();
    }
  3. Run test with 'zig build test'
  4. zig test runner hangs: [3/5] steps └─ [1/2] run test └─ main.test.bw.flush() has to be commentte

Expected Behavior

If comment out the 'bw.flush();', test can run normally. Since the generated code emphasized 'don't forget to flush!', it might be something wrong within implementation of std.io.bufferedWriter?

nektro commented 2 weeks ago

duplicate of https://github.com/ziglang/zig/issues/15091

PegasusPlusUS commented 2 weeks ago

Thank a lot! Checking #15091, it was marked as "added this to the 0.11.0 milestone on Apr 10, 2023" So still not resolved?

It's really confusing because if zig want to update building progress, I guess before build complete, test runner already started? Maybe after zig complete building, then test runner start, there will be no conflict on stdout.