From f0b768988d2c28f854195212d98b4fd3a7f654da Mon Sep 17 00:00:00 2001 From: Techatrix Date: Mon, 13 Jul 2026 00:06:57 +0200 Subject: [PATCH] do not inherit stdio of run step when running the build system protocol --- lib/compiler/Maker/Step/Run.zig | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/compiler/Maker/Step/Run.zig b/lib/compiler/Maker/Step/Run.zig index 488225aadca8deb146e8fc1a2fd4c196c3811b2f..9da088639e68ef12d2b1ce65928ac0f86006ad06 100644 --- a/lib/compiler/Maker/Step/Run.zig +++ b/lib/compiler/Maker/Step/Run.zig @@ -2201,25 +2201,35 @@ fn spawnChildAndCollect( assert(conf_run.flags.stdio != .inherit); break :s .pipe; } else switch (conf_run.flags.stdio) { - .infer_from_args => if (has_side_effects) .inherit else .ignore, + .infer_from_args => if (maker.protocol_server == null and has_side_effects) .inherit else .ignore, .inherit => .inherit, .check => .ignore, .zig_test => .pipe, }, .stdout = if (conf_run.captured_stdout.value != null) .pipe else switch (conf_run.flags.stdio) { - .infer_from_args => if (has_side_effects) .inherit else .ignore, + .infer_from_args => if (maker.protocol_server == null and has_side_effects) .inherit else .ignore, .inherit => .inherit, .check => if (checksContainStdout(&conf_run)) .pipe else .ignore, .zig_test => .pipe, }, .stderr = if (conf_run.captured_stderr.value != null) .pipe else switch (conf_run.flags.stdio) { - .infer_from_args => if (has_side_effects) .inherit else .pipe, - .inherit => .inherit, + .infer_from_args => if (maker.protocol_server == null and has_side_effects) .inherit else .pipe, + .inherit => if (maker.protocol_server == null) .inherit else .pipe, .check => .pipe, .zig_test => .pipe, }, }; + if (maker.protocol_server != null) { + if (spawn_options.stdin == .inherit) { + return step.fail(maker, "Cannot inherit stdin when running through over the build system protocol", .{}); + } + if (spawn_options.stdout == .inherit) { + return step.fail(maker, "Cannot inherit stdout when running through over the build system protocol", .{}); + } + assert(spawn_options.stderr != .inherit); + } + if (conf_run.flags.stdio == .zig_test) { try setColorEnvironmentVariables(&conf_run, environ_map, graph.stderr_mode.?); const started: Io.Clock.Timestamp = .now(io, .awake); -- 2.54.0