summaryrefslogtreecommitdiff
path: root/src/builtins.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 08:20:20 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commit8157972cff633ee0135c81fd3f1195d9a73eb92f (patch)
tree479096be1049ba53ce92918f39e5a557cae02c0a /src/builtins.zig
parenta0114d0b8be05d62bc1eb0e68642f7c31a766ade (diff)
downloadpardes-8157972cff633ee0135c81fd3f1195d9a73eb92f.tar.gz
pardes-8157972cff633ee0135c81fd3f1195d9a73eb92f.zip
A builtin failure over something not there answers ENOENT: Unmount of a name not mounted
`Unmount nothere` failed EIO with `not mounted`. It says `no such mount nothere` now, and a builtin's failure that says `no such` (this, Tty's `no such directory`) answers ENOENT, the errno 9ns reads from those words. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/builtins.zig')
-rw-r--r--src/builtins.zig9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/builtins.zig b/src/builtins.zig
index 59fc140d..095eadbd 100644
--- a/src/builtins.zig
+++ b/src/builtins.zig
@@ -705,7 +705,14 @@ pub const Unmount = struct {
var args = std.mem.tokenizeAny(u8, c.arg orelse "", " \t");
const name = args.next() orelse return c.p.reportError(c.id, "Unmount name", error.MissingArgument);
if (args.next() != null) return c.p.reportError(c.id, "Unmount name", error.TooManyArguments);
- pardes.filesystem.unmount(c.p, name) catch |err| return c.p.reportError(c.id, "Unmount", err);
+ pardes.filesystem.unmount(c.p, name) catch |err| {
+ // "no such": the words 9ns reads as ENOENT.
+ if (err == error.NotMounted) {
+ var said: [96]u8 = undefined;
+ return c.p.reportFailure(c.id, std.fmt.bufPrint(&said, "Unmount: no such mount {s}", .{name[0..@min(name.len, 32)]}) catch "Unmount: no such mount");
+ }
+ return c.p.reportError(c.id, "Unmount", err);
+ };
}
};