summaryrefslogtreecommitdiff
path: root/src/builtins.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/builtins.zig')
-rw-r--r--src/builtins.zig15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/builtins.zig b/src/builtins.zig
index 404e78f4..3f4a680c 100644
--- a/src/builtins.zig
+++ b/src/builtins.zig
@@ -676,6 +676,21 @@ pub const Mount = struct {
const dial = std.mem.trim(u8, args.rest(), " \t");
if (dial.len == 0) return c.p.reportError(c.id, "Mount name dial", error.MissingArgument);
c.p.fs.mount(c.p.gpa, name, dial) catch |err| return c.p.reportError(c.id, "Mount", err);
+ // A mount that cannot be reached is said now, and taken back, not
+ // found out by the first look through it.
+ const reached = reached: {
+ pardes.turn.yield();
+ defer pardes.turn.back();
+ break :reached @import("9p_io.zig").Client.probe(c.p.gpa, dial);
+ };
+ reached catch |err| {
+ if (c.p.fs.mounts.pop()) |gone| {
+ c.p.gpa.free(gone.name);
+ c.p.gpa.free(gone.dial);
+ }
+ var what: [160]u8 = undefined;
+ return c.p.reportError(c.id, std.fmt.bufPrint(&what, "Mount {s} {s}", .{ name, dial[0..@min(dial.len, 100)] }) catch "Mount", err);
+ };
}
};