authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-05-27 11:21:04-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-05-27 20:56:49-07:00
loga5e4fe5487d2ac8d8bafceb6edba8ae2d87aa86c
treec56d8eb7c6f84a7e69c398daff147123704ed292
parent0937992a14e9557da7d753f3c38070fe57583e33

std.Build.Step.Run: account for new environment variable

Introduces `disable_zig_progress` which prevents the build runner from assigning the child process a progress node. This is needed for the empty_env test which requires the environment to be completely empty.

2 files changed, 8 insertions(+), 1 deletions(-)

lib/std/Build/Step/Run.zig+7-1
......@@ -23,6 +23,11 @@ cwd: ?Build.LazyPath,
2323/// Override this field to modify the environment, or use setEnvironmentVariable
2424env_map: ?*EnvMap,
2525
26/// When `true` prevents `ZIG_PROGRESS` environment variable from being passed
27/// to the child process, which otherwise would be used for the child to send
28/// progress updates to the parent.
29disable_zig_progress: bool,
30
2631/// Configures whether the Run step is considered to have side-effects, and also
2732/// whether the Run step will inherit stdio streams, forwarding them to the
2833/// parent process, in which case will require a global lock to prevent other
......@@ -152,6 +157,7 @@ pub fn create(owner: *std.Build, name: []const u8) *Run {
152157 .argv = .{},
153158 .cwd = null,
154159 .env_map = null,
160 .disable_zig_progress = false,
155161 .stdio = .infer_from_args,
156162 .stdin = .none,
157163 .extra_file_dependencies = &.{},
......@@ -1235,7 +1241,7 @@ fn spawnChildAndCollect(
12351241 child.stdin_behavior = .Pipe;
12361242 }
12371243
1238 if (run.stdio != .zig_test) {
1244 if (run.stdio != .zig_test and !run.disable_zig_progress) {
12391245 child.progress_node = prog_node;
12401246 }
12411247
test/standalone/empty_env/build.zig+1
......@@ -21,6 +21,7 @@ pub fn build(b: *std.Build) void {
2121
2222 const run = b.addRunArtifact(main);
2323 run.clearEnvironment();
24 run.disable_zig_progress = true;
2425
2526 test_step.dependOn(&run.step);
2627}