authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-11-26 13:56:12-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-11-26 13:56:40-08:00
log11bf2d92de5f335d4e07358d99f26fae08493f12
treebf32c9bbacdaaa17eeba1112508737e34b00bc1e
parent68b3f5086609b8e904edcec9ef2201cb54bc7200

diversify "unable to spawn" failure messages

to help understand where a spurious failure is occurring

6 files changed, 9 insertions(+), 9 deletions(-)

lib/std/Build/Step.zig+2-2
...@@ -339,7 +339,7 @@ pub fn captureChildProcess(...@@ -339,7 +339,7 @@ pub fn captureChildProcess(
339 .allocator = arena,339 .allocator = arena,
340 .argv = argv,340 .argv = argv,
341 .progress_node = progress_node,341 .progress_node = progress_node,
342 }) catch |err| return s.fail("unable to spawn {s}: {s}", .{ argv[0], @errorName(err) });342 }) catch |err| return s.fail("failed to run {s}: {s}", .{ argv[0], @errorName(err) });
343343
344 if (result.stderr.len > 0) {344 if (result.stderr.len > 0) {
345 try s.result_error_msgs.append(arena, result.stderr);345 try s.result_error_msgs.append(arena, result.stderr);
...@@ -423,7 +423,7 @@ pub fn evalZigProcess(...@@ -423,7 +423,7 @@ pub fn evalZigProcess(
423 child.request_resource_usage_statistics = true;423 child.request_resource_usage_statistics = true;
424 child.progress_node = prog_node;424 child.progress_node = prog_node;
425425
426 child.spawn() catch |err| return s.fail("unable to spawn {s}: {s}", .{426 child.spawn() catch |err| return s.fail("failed to spawn zig compiler {s}: {s}", .{
427 argv[0], @errorName(err),427 argv[0], @errorName(err),
428 });428 });
429429
lib/std/Build/Step/Run.zig+1-1
...@@ -1137,7 +1137,7 @@ fn runCommand(...@@ -1137,7 +1137,7 @@ fn runCommand(
1137 };1137 };
1138 }1138 }
11391139
1140 return step.fail("unable to spawn {s}: {s}", .{ argv[0], @errorName(err) });1140 return step.fail("failed to spawn and capture stdio from {s}: {s}", .{ argv[0], @errorName(err) });
1141 };1141 };
11421142
1143 step.result_duration_ns = result.elapsed_ns;1143 step.result_duration_ns = result.elapsed_ns;
src/Compilation.zig+2-2
...@@ -4772,7 +4772,7 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: std.Pr...@@ -4772,7 +4772,7 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: std.Pr
4772 child.stderr_behavior = .Inherit;4772 child.stderr_behavior = .Inherit;
47734773
4774 const term = child.spawnAndWait() catch |err| {4774 const term = child.spawnAndWait() catch |err| {
4775 return comp.failCObj(c_object, "unable to spawn {s}: {s}", .{ argv.items[0], @errorName(err) });4775 return comp.failCObj(c_object, "failed to spawn zig clang (passthrough mode) {s}: {s}", .{ argv.items[0], @errorName(err) });
4776 };4776 };
4777 switch (term) {4777 switch (term) {
4778 .Exited => |code| {4778 .Exited => |code| {
...@@ -4794,7 +4794,7 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: std.Pr...@@ -4794,7 +4794,7 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: std.Pr
4794 const stderr = try child.stderr.?.reader().readAllAlloc(arena, std.math.maxInt(usize));4794 const stderr = try child.stderr.?.reader().readAllAlloc(arena, std.math.maxInt(usize));
47954795
4796 const term = child.wait() catch |err| {4796 const term = child.wait() catch |err| {
4797 return comp.failCObj(c_object, "unable to spawn {s}: {s}", .{ argv.items[0], @errorName(err) });4797 return comp.failCObj(c_object, "failed to spawn zig clang {s}: {s}", .{ argv.items[0], @errorName(err) });
4798 };4798 };
47994799
4800 switch (term) {4800 switch (term) {
src/link.zig+1-1
...@@ -1648,7 +1648,7 @@ pub fn spawnLld(...@@ -1648,7 +1648,7 @@ pub fn spawnLld(
1648 },1648 },
1649 else => first_err,1649 else => first_err,
1650 };1650 };
1651 log.err("unable to spawn {s}: {s}", .{ argv[0], @errorName(err) });1651 log.err("unable to spawn LLD {s}: {s}", .{ argv[0], @errorName(err) });
1652 return error.UnableToSpawnSelf;1652 return error.UnableToSpawnSelf;
1653 };1653 };
16541654
src/link/Wasm.zig+2-2
...@@ -3722,7 +3722,7 @@ fn linkWithLLD(wasm: *Wasm, arena: Allocator, tid: Zcu.PerThread.Id, prog_node:...@@ -3722,7 +3722,7 @@ fn linkWithLLD(wasm: *Wasm, arena: Allocator, tid: Zcu.PerThread.Id, prog_node:
3722 child.stderr_behavior = .Inherit;3722 child.stderr_behavior = .Inherit;
37233723
3724 const term = child.spawnAndWait() catch |err| {3724 const term = child.spawnAndWait() catch |err| {
3725 log.err("unable to spawn {s}: {s}", .{ argv.items[0], @errorName(err) });3725 log.err("failed to spawn (passthrough mode) LLD {s}: {s}", .{ argv.items[0], @errorName(err) });
3726 return error.UnableToSpawnWasm;3726 return error.UnableToSpawnWasm;
3727 };3727 };
3728 switch (term) {3728 switch (term) {
...@@ -3743,7 +3743,7 @@ fn linkWithLLD(wasm: *Wasm, arena: Allocator, tid: Zcu.PerThread.Id, prog_node:...@@ -3743,7 +3743,7 @@ fn linkWithLLD(wasm: *Wasm, arena: Allocator, tid: Zcu.PerThread.Id, prog_node:
3743 const stderr = try child.stderr.?.reader().readAllAlloc(arena, std.math.maxInt(usize));3743 const stderr = try child.stderr.?.reader().readAllAlloc(arena, std.math.maxInt(usize));
37443744
3745 const term = child.wait() catch |err| {3745 const term = child.wait() catch |err| {
3746 log.err("unable to spawn {s}: {s}", .{ argv.items[0], @errorName(err) });3746 log.err("failed to spawn LLD {s}: {s}", .{ argv.items[0], @errorName(err) });
3747 return error.UnableToSpawnWasm;3747 return error.UnableToSpawnWasm;
3748 };3748 };
37493749
src/main.zig+1-1
...@@ -5244,7 +5244,7 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {...@@ -5244,7 +5244,7 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {
5244 std.debug.lockStdErr();5244 std.debug.lockStdErr();
5245 defer std.debug.unlockStdErr();5245 defer std.debug.unlockStdErr();
5246 break :t child.spawnAndWait() catch |err| {5246 break :t child.spawnAndWait() catch |err| {
5247 fatal("unable to spawn {s}: {s}", .{ child_argv.items[0], @errorName(err) });5247 fatal("failed to spawn build runner {s}: {s}", .{ child_argv.items[0], @errorName(err) });
5248 };5248 };
5249 };5249 };
52505250