diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-28 16:36:16 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:15 -0300 |
| commit | 5715121328de6851d1cc5cd56ab19eb521d4b6fc (patch) | |
| tree | 251834276691e50e8389c38de39dbd876e7a19b4 /src/builtins.zig | |
| parent | b586d916c2aac1e5e577162898ebb86632f32db0 (diff) | |
| download | pardes-5715121328de6851d1cc5cd56ab19eb521d4b6fc.tar.gz pardes-5715121328de6851d1cc5cd56ab19eb521d4b6fc.zip | |
The web and board builds compile again: a shell's lookup and a dump's read are the host's
The Tty shell check sized a buffer with std.fs.max_path_bytes and the
Restore check read the dump through the host filesystem, both in the core,
which the wasm32-freestanding build cannot compile (no PATH_MAX, no libc).
Both now run only where there is a host, as the rest of that code does.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/builtins.zig')
| -rw-r--r-- | src/builtins.zig | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/builtins.zig b/src/builtins.zig index 557145cb..76d7dfb0 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -508,7 +508,8 @@ pub const Restore = struct { // A dump that cannot be read is said now, and fails a ctl write: the // host reads it only after this step, where nobody hears. First, // so a Restore that could never happen spends no warning. - const bytes = @import("fs.zig").readRestore(c.p.gpa, path, c.p.settings.dump_dir.get()) catch |err| { + if (comptime pardes.hosted) { + const bytes = @import("fs.zig").readRestore(c.p.gpa, path, c.p.settings.dump_dir.get()) catch |err| { var buf: [limits.host_path_cap + 64]u8 = undefined; const why = switch (err) { error.FileNotFound => "no such file", @@ -517,8 +518,9 @@ pub const Restore = struct { else => @errorName(err), }; return c.p.reportFailure(c.id, std.fmt.bufPrint(&buf, "Restore: {s}: {s}", .{ path, why }) catch "Restore: cannot read the dump"); - }; - c.p.gpa.free(bytes); + }; + c.p.gpa.free(bytes); + } // acme's Load adds a dump's windows to the ones there; a Restore // replaces them all, so it asks what Exit asks first. if (warnModified(c, .Restore)) return; @@ -881,13 +883,13 @@ pub const Tty = struct { const arg = std.mem.trim(u8, c.arg orelse "", " \t"); // A shell that is not there is said, where the host would quietly // start its fallback in its place. - if (arg.len > 0) { + if (comptime pardes.hosted) if (arg.len > 0) { var buf: [std.fs.max_path_bytes]u8 = undefined; - if (comptime pardes.hosted) if (@import("host_io.zig").Shell.find(arg, &buf) == null) { + if (@import("host_io.zig").Shell.find(arg, &buf) == null) { var said: [320]u8 = undefined; return c.p.reportFailure(c.id, std.fmt.bufPrint(&said, "Tty: no shell \"{s}\" (a name on the usual paths, or a path to one)", .{arg[0..@min(arg.len, 200)]}) catch "Tty: no such shell"); - }; - } + } + }; const pane = exec.spawnTty(c.p, c.id) orelse return; if (arg.len > 0) pane.shell = c.p.gpa.dupe(u8, arg) catch null; } |
