zig/lib/std/Build/Step
Alex Kladov 865ef24518 build: don't hang when capturing Stdout of verbose Build.Step.Run
When using Build.Step.Run.captureStdOut with a program that prints more
than 10 megabytes of output, the build process hangs.

This is because evalGeneric returns an error without reading child's
stdin till the end, so we subsequently get stuck in `try child.wait()`.

To fix this, make sure to kill the child in case of an error!

Output before this change:

    λ ./zig/zig build  -Dmultiversion=0.15.6 -Dconfig-release=0.15.7 -Dconfig-release-client-min=0.15.6
    [3/8] steps
    └─ run gh
    ^C
    λ # an hour of debugging

Output after this change:

    λ ./zig/zig build  -Dmultiversion=0.15.6 -Dconfig-release=0.15.7 -Dconfig-release-client-min=0.15.6
    install
    └─ install generated to ../tigerbeetle
       └─ run build_mutliversion (tigerbeetle)
          └─ run unzip
             └─ run gh failure
    error: unable to spawn gh: StdoutStreamTooLong
    Build Summary: 3/8 steps succeeded; 1 failed (disable with --summary none)
    install transitive failure
    └─ install generated to ../tigerbeetle transitive failure
       └─ run build_mutliversion (tigerbeetle) transitive failure
          └─ run unzip transitive failure
             └─ run gh failure
    error: the following build command failed with exit code 1:
    /home/matklad/p/tb/work/.zig-cache/o/c0e3f5e66ff441cd16f9a1a7e1401494/build /home/matklad/p/tb/work/zig/zig /home/matklad/p/tb/work /home/matklad/p/tb/work/.zig-cache /home/matklad/.cache/zig --seed 0xc1d4efc8 -Zaecc61299ff08765 -Dmultiversion=0.15.6 -Dconfig-release=0.15.7 -Dconfig-release-client-min=0.15.6
2024-11-19 11:50:38 -08:00
..
CheckFile.zig make zig compiler processes live across rebuilds 2024-07-14 19:51:16 -07:00
CheckObject.zig std.Build.Step.CheckObject: display source file path 2024-10-10 14:21:52 -07:00
Compile.zig introduce a CLI flag to enable .so scripts; default off 2024-10-23 16:27:38 -07:00
ConfigHeader.zig std: update std.builtin.Type fields to follow naming conventions 2024-08-28 08:39:59 +01:00
Fail.zig make zig compiler processes live across rebuilds 2024-07-14 19:51:16 -07:00
Fmt.zig Replace deprecated default initializations with decl literals 2024-09-12 16:01:23 +01:00
InstallArtifact.zig fix various issues related to Path handling in the compiler and std 2024-08-19 19:09:11 +02:00
InstallDir.zig make zig compiler processes live across rebuilds 2024-07-14 19:51:16 -07:00
InstallFile.zig make zig compiler processes live across rebuilds 2024-07-14 19:51:16 -07:00
ObjCopy.zig 19009: zig objcopy: integrate --add-section, --set-section-alignment and --set-section-flags into std.Build.Step.ObjCopy 2024-10-04 15:49:50 +02:00
Options.zig std: update std.builtin.Type fields to follow naming conventions 2024-08-28 08:39:59 +01:00
RemoveDir.zig make zig compiler processes live across rebuilds 2024-07-14 19:51:16 -07:00
Run.zig build: don't hang when capturing Stdout of verbose Build.Step.Run 2024-11-19 11:50:38 -08:00
TranslateC.zig replace TranslateC.addIncludeDir with variants with LazyPath/library names 2024-09-25 21:50:55 -07:00
UpdateSourceFiles.zig make zig compiler processes live across rebuilds 2024-07-14 19:51:16 -07:00
WriteFile.zig make zig compiler processes live across rebuilds 2024-07-14 19:51:16 -07:00