summaryrefslogtreecommitdiff
path: root/src/detached
diff options
context:
space:
mode:
Diffstat (limited to 'src/detached')
-rw-r--r--src/detached/client.zig3
-rw-r--r--src/detached/server.zig8
2 files changed, 6 insertions, 5 deletions
diff --git a/src/detached/client.zig b/src/detached/client.zig
index 4468c961..ba533751 100644
--- a/src/detached/client.zig
+++ b/src/detached/client.zig
@@ -838,6 +838,7 @@ test "detached Restore keeps attached frontends and follows queued frames with a
const fd = h.session.clients[c.slot].fd;
try testing.expectError(error.BadDumpMagic, h.session.restore(
".{ .magic = \"not-a-pardes-dump\", .theme = \"dark\", .screen = .{ .cols = 60, .rows = 16 } }",
+ "test",
));
try testing.expectEqual(before, h.session.core);
try testing.expectEqual(fd, h.session.clients[c.slot].fd);
@@ -848,7 +849,7 @@ test "detached Restore keeps attached frontends and follows queued frames with a
defer testing.allocator.free(saved);
while (h.core.nextEffect()) |_| {}
_ = try h.core.setTestFile("changed after dump\n");
- try h.session.restore(saved);
+ try h.session.restore(saved, "test");
h.core = h.session.core;
try testing.expect(h.core != before);
try testing.expectEqual(fd, h.session.clients[c.slot].fd);
diff --git a/src/detached/server.zig b/src/detached/server.zig
index 5c0e1487..b088d833 100644
--- a/src/detached/server.zig
+++ b/src/detached/server.zig
@@ -233,8 +233,8 @@ pub const Session = struct {
return batch.len != 0 or batch.status != null;
}
- pub fn restore(s: *Session, bytes: []const u8) !void {
- const replacement = try dump.restore(s.core, bytes);
+ pub fn restore(s: *Session, bytes: []const u8, from: []const u8) !void {
+ const replacement = try dump.restore(s.core, bytes, from);
s.cancelWorkers();
for (0..s.ptys.len) |pane| s.closePty(@intCast(pane));
s.harvest();
@@ -1183,7 +1183,7 @@ pub fn run(init: std.process.Init, opts: pardes.Options, name: []const u8) !void
break :restore;
};
defer gpa.free(bytes);
- session.restore(bytes) catch |err| session.core.reportError(session.core.active, "Restore", err);
+ session.restore(bytes, path) catch |err| session.core.reportError(session.core.active, "Restore", err);
}
}
}
@@ -1223,7 +1223,7 @@ test "detached queued results preserve current requests and are discarded before
try std.testing.expect(s.pipe_tasks.add(.{ .id = 77, .future = .{ .any_future = null, .result = {} } }));
s.mailbox.post(.{ .pipe = .{ .id = 77, .success = true, .outputs = outputs } });
Session.lspStatus(&s, "old status");
- try s.restore(saved);
+ try s.restore(saved, "test");
try std.testing.expect(s.lsp_task == null);
try std.testing.expectEqual(@as(usize, 0), s.pipe_tasks.len);
try std.testing.expect(!s.drainCompletions(true));