summaryrefslogtreecommitdiff
path: root/util/file.zig
diff options
context:
space:
mode:
Diffstat (limited to 'util/file.zig')
-rw-r--r--util/file.zig4
1 files changed, 3 insertions, 1 deletions
diff --git a/util/file.zig b/util/file.zig
index 90849e9..c63422a 100644
--- a/util/file.zig
+++ b/util/file.zig
@@ -8,8 +8,10 @@ pub fn slurp(allocator: std.mem.Allocator, file_path: []const u8) ![]u8 {
const file = try std.fs.openFileAbsolute(path, .{});
defer file.close();
- return try file.readToEndAlloc(
+ var buf = try file.readToEndAlloc(
allocator,
(try file.stat()).size,
);
+
+ return allocator.resize(buf, buf.len-1).?;
}