authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-05-23 12:15:00-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-05-25 18:54:36-07:00
logfa7433a924794b0e40e522680710c60859c65db1
tree5ca99abf8a210ef7e81fbf426f6268430e40dd11
parent8b4e55372a51bd2d6869cd3cc1e90939de3b568f

fix std-docs.zig compilation


1 files changed, 16 insertions(+), 37 deletions(-)

lib/compiler/std-docs.zig+16-37
......@@ -271,12 +271,16 @@ fn serveWasm(
271271 // Do the compilation every request, so that the user can edit the files
272272 // and see the changes without restarting the server.
273273 const wasm_base_path = try buildWasmBinary(arena, context, optimize_mode);
274 const target = std.zig.system.resolveTargetQuery(io, std.Build.parseTargetQuery(.{
275 .arch_os_abi = autodoc_arch_os_abi,
276 .cpu_features = autodoc_cpu_features,
277 }) catch unreachable) catch unreachable;
274278 const bin_name = try std.zig.binNameAlloc(arena, .{
275279 .root_name = autodoc_root_name,
276 .target = &(std.zig.system.resolveTargetQuery(io, std.Build.parseTargetQuery(.{
277 .arch_os_abi = autodoc_arch_os_abi,
278 .cpu_features = autodoc_cpu_features,
279 }) catch unreachable) catch unreachable),
280 .cpu_arch = target.cpu.arch,
281 .os_tag = target.os.tag,
282 .ofmt = target.ofmt,
283 .abi = target.abi,
280284 .output_mode = .Exe,
281285 });
282286 // std.http.Server does not have a sendfile API yet.
......@@ -406,51 +410,26 @@ fn buildWasmBinary(
406410 child.stdin.?.close(io);
407411 child.stdin = null;
408412
409 switch (try child.wait(io)) {
410 .exited => |code| {
411 if (code != 0) {
412 std.log.err(
413 "the following command exited with error code {d}:\n{s}",
414 .{ code, try std.Build.Step.allocPrintCmd(arena, .inherit, null, argv.items) },
415 );
416 return error.WasmCompilationFailed;
417 }
418 },
419 .signal => |sig| {
420 std.log.err(
421 "the following command terminated with signal {t}:\n{s}",
422 .{ sig, try std.Build.Step.allocPrintCmd(arena, .inherit, null, argv.items) },
423 );
424 return error.WasmCompilationFailed;
425 },
426 .stopped => |sig| {
427 std.log.err(
428 "the following command stopped unexpectedly with signal {t}:\n{s}",
429 .{ sig, try std.Build.Step.allocPrintCmd(arena, .inherit, null, argv.items) },
430 );
431 return error.WasmCompilationFailed;
432 },
433 .unknown => {
434 std.log.err(
435 "the following command terminated unexpectedly:\n{s}",
436 .{try std.Build.Step.allocPrintCmd(arena, .inherit, null, argv.items)},
437 );
438 return error.WasmCompilationFailed;
439 },
413 const term = try child.wait(io);
414 if (!term.success()) {
415 std.log.err("the following command {f}:\n{s}", .{
416 term, try std.zig.allocPrintCmd(arena, argv.items, .{}),
417 });
418 return error.WasmCompilationFailed;
440419 }
441420
442421 if (result_error_bundle.errorMessageCount() > 0) {
443422 try result_error_bundle.renderToStderr(io, .{}, .auto);
444423 std.log.err("the following command failed with {d} compilation errors:\n{s}", .{
445424 result_error_bundle.errorMessageCount(),
446 try std.Build.Step.allocPrintCmd(arena, .inherit, null, argv.items),
425 try std.zig.allocPrintCmd(arena, argv.items, .{}),
447426 });
448427 return error.WasmCompilationFailed;
449428 }
450429
451430 return result orelse {
452431 std.log.err("child process failed to report result\n{s}", .{
453 try std.Build.Step.allocPrintCmd(arena, .inherit, null, argv.items),
432 try std.zig.allocPrintCmd(arena, argv.items, .{}),
454433 });
455434 return error.WasmCompilationFailed;
456435 };