Commit 37a7d2c78d

Andrew Kelley <andrew@ziglang.org>
2023-03-14 22:36:34
std.Build.RunStep: fix handling spawn failure
The error was caught and created a Step failure rather than bubbling up so that the interpreter logic could handle it. Fixes hundreds of test failures on Windows.
1 parent 11de55d
Changed files (1)
lib
std
lib/std/Build/RunStep.zig
@@ -676,7 +676,7 @@ fn runCommand(
             try Step.handleVerbose2(step.owner, self.cwd, self.env_map, interp_argv.items);
 
             break :term spawnChildAndCollect(self, interp_argv.items, has_side_effects, prog_node) catch |e| {
-                return step.fail("unable to spawn {s}: {s}", .{
+                return step.fail("unable to spawn interpreter {s}: {s}", .{
                     interp_argv.items[0], @errorName(e),
                 });
             };
@@ -889,9 +889,7 @@ fn spawnChildAndCollect(
         child.stdin_behavior = .Pipe;
     }
 
-    child.spawn() catch |err| return self.step.fail("unable to spawn {s}: {s}", .{
-        argv[0], @errorName(err),
-    });
+    try child.spawn();
     var timer = try std.time.Timer.start();
 
     const result = if (self.stdio == .zig_test)