| ... | @@ -159,8 +159,6 @@ pub const CacheHash = struct { | ... | @@ -159,8 +159,6 @@ pub const CacheHash = struct { |
| 159 | } | 159 | } |
| 160 | | 160 | |
| 161 | const this_file = fs.cwd().openFile(cache_hash_file.path.?, .{ .read = true }) catch { | 161 | const this_file = fs.cwd().openFile(cache_hash_file.path.?, .{ .read = true }) catch { |
| 162 | self.manifest_file.?.close(); | | |
| 163 | self.manifest_file = null; | | |
| 164 | return error.CacheUnavailable; | 162 | return error.CacheUnavailable; |
| 165 | }; | 163 | }; |
| 166 | defer this_file.close(); | 164 | defer this_file.close(); |
| ... | @@ -213,8 +211,6 @@ pub const CacheHash = struct { | ... | @@ -213,8 +211,6 @@ pub const CacheHash = struct { |
| 213 | while (idx < input_file_count) : (idx += 1) { | 211 | while (idx < input_file_count) : (idx += 1) { |
| 214 | var cache_hash_file = &self.files.items[idx]; | 212 | var cache_hash_file = &self.files.items[idx]; |
| 215 | const contents = self.populate_file_hash(cache_hash_file) catch |err| { | 213 | const contents = self.populate_file_hash(cache_hash_file) catch |err| { |
| 216 | self.manifest_file.?.close(); | | |
| 217 | self.manifest_file = null; | | |
| 218 | return error.CacheUnavailable; | 214 | return error.CacheUnavailable; |
| 219 | }; | 215 | }; |
| 220 | } | 216 | } |
| ... | @@ -256,12 +252,7 @@ pub const CacheHash = struct { | ... | @@ -256,12 +252,7 @@ pub const CacheHash = struct { |
| 256 | var cache_hash_file = try self.files.addOne(); | 252 | var cache_hash_file = try self.files.addOne(); |
| 257 | cache_hash_file.path = try fs.path.resolve(self.alloc, &[_][]const u8{file_path}); | 253 | cache_hash_file.path = try fs.path.resolve(self.alloc, &[_][]const u8{file_path}); |
| 258 | | 254 | |
| 259 | const contents = self.populate_file_hash_fetch(otherAlloc, cache_hash_file) catch |err| { | 255 | return try self.populate_file_hash_fetch(otherAlloc, cache_hash_file); |
| 260 | self.manifest_file.close(); | | |
| 261 | return err; | | |
| 262 | }; | | |
| 263 | | | |
| 264 | return contents; | | |
| 265 | } | 256 | } |
| 266 | | 257 | |
| 267 | /// Add a file as a dependency of process being cached, after the initial hash has been | 258 | /// Add a file as a dependency of process being cached, after the initial hash has been |
| ... | @@ -317,6 +308,7 @@ pub const CacheHash = struct { | ... | @@ -317,6 +308,7 @@ pub const CacheHash = struct { |
| 317 | } | 308 | } |
| 318 | | 309 | |
| 319 | self.manifest_file.?.close(); | 310 | self.manifest_file.?.close(); |
| | 311 | |
| 320 | for (self.files.toSlice()) |*file| { | 312 | for (self.files.toSlice()) |*file| { |
| 321 | file.deinit(self.alloc); | 313 | file.deinit(self.alloc); |
| 322 | } | 314 | } |