Skip to content

ability for RunStep with stdio inherit mode to succeed when the child process has a failing exit code #14996

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
leecannon opened this issue Mar 18, 2023 · 3 comments
Labels
proposal This issue suggests modifications. If it also has the "accepted" label then it is planned. zig build system std.Build, the build runner, `zig build` subcommand, package management
Milestone

Comments

@leecannon
Copy link
Contributor

After the merge of #14647 the ability to ignore the exit code of a RunStep to determine success has been removed.

This means that if you use a RunStep to execute your program and it fails due to incorrect arguments, incorrect system state or some other reason the build runner outputs a failed build summary even though in this situation the build was fine.

@Vexu Vexu added bug Observed behavior contradicts documented or intended behavior zig build system std.Build, the build runner, `zig build` subcommand, package management regression It worked in a previous version of Zig, but stopped working. labels Mar 18, 2023
@Vexu Vexu added this to the 0.11.0 milestone Mar 18, 2023
@andrewrk
Copy link
Member

Please share some example code for us to examine

@leecannon
Copy link
Contributor Author

build.zig:
https://github.com/leecannon/zig-coreutils/blob/a817a79dc98fd394a454d214c1c990a3d889c498/build.zig#L103-L110

result of running with invalid argument (release safe is to disable debug logging):

$ zig build run -Doptimize=ReleaseSafe -- groups user_doesnt_exist
groups: unknown user user_doesnt_exist
run zig-coreutils: error: the following command exited with error code 1:
/home/lee/src/zig-coreutils/zig-out/bin/zig-coreutils groups user_doesnt_exist
Build Summary: 4/6 steps succeeded; 1 failed (disable with -fno-summary)
run transitive failure
└─ run zig-coreutils failure
   ├─ zig build-exe zig-coreutils ReleaseSafe native cached 3ms MaxRSS:35M
   │  └─ options success
   └─ install cached
      └─ install zig-coreutils cached
         └─ zig build-exe zig-coreutils ReleaseSafe native (+1 more reused dependencies)
error: the following build command failed with exit code 1:
/home/lee/src/zig-coreutils/zig-cache/o/ce807d9c2f8585b39598d5fcb20dd3a0/build /home/lee/zig/0.11.0-dev.2157+f56f3c582/files/zig /home/lee/src/zig-coreutils /home/lee/src/zig-coreutils/zig-cache /home/lee/.cache/zig run -Doptimize=ReleaseSafe -- groups user_doesnt_exist

desired output:

$ zig build run -Doptimize=ReleaseSafe -- groups user_doesnt_exist
groups: unknown user user_doesnt_exist

@andrewrk andrewrk added proposal This issue suggests modifications. If it also has the "accepted" label then it is planned. and removed bug Observed behavior contradicts documented or intended behavior regression It worked in a previous version of Zig, but stopped working. labels Mar 18, 2023
@andrewrk andrewrk changed the title RunStep can no longer ignore exit code ability for RunStep with stdio inherit mode to succeed when the child process has a failing exit code Mar 18, 2023
@andrewrk
Copy link
Member

This is working entirely as designed. It seems like you would rather run your command without the build system?

@andrewrk andrewrk modified the milestones: 0.11.0, 0.12.0 Jul 20, 2023
@andrewrk andrewrk modified the milestones: 0.14.0, 0.15.0 Feb 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal This issue suggests modifications. If it also has the "accepted" label then it is planned. zig build system std.Build, the build runner, `zig build` subcommand, package management
Projects
None yet
Development

No branches or pull requests

3 participants