| ... | @@ -1291,11 +1291,12 @@ pub const Directories = struct { | ... | @@ -1291,11 +1291,12 @@ pub const Directories = struct { |
| 1291 | pub fn deinit(dirs: *Directories, io: Io) void { | 1291 | pub fn deinit(dirs: *Directories, io: Io) void { |
| 1292 | // The local and global caches could be the same. | 1292 | // The local and global caches could be the same. |
| 1293 | const close_local = dirs.local_cache.handle.handle != dirs.global_cache.handle.handle; | 1293 | const close_local = dirs.local_cache.handle.handle != dirs.global_cache.handle.handle; |
| | 1294 | const close_build_root = dirs.build_root.handle.handle != Io.Dir.cwd().handle; |
| 1294 | | 1295 | |
| 1295 | dirs.global_cache.handle.close(io); | 1296 | dirs.global_cache.handle.close(io); |
| 1296 | if (close_local) dirs.local_cache.handle.close(io); | 1297 | if (close_local) dirs.local_cache.handle.close(io); |
| 1297 | dirs.zig_lib.handle.close(io); | 1298 | dirs.zig_lib.handle.close(io); |
| 1298 | if (dirs.build_root.path != null) dirs.build_root.handle.close(io); | 1299 | if (close_build_root) dirs.build_root.handle.close(io); |
| 1299 | } | 1300 | } |
| 1300 | | 1301 | |
| 1301 | /// Returns a `Directories` where `local_cache` is replaced with `global_cache`, intended for | 1302 | /// Returns a `Directories` where `local_cache` is replaced with `global_cache`, intended for |
| ... | @@ -1346,7 +1347,6 @@ pub const Directories = struct { | ... | @@ -1346,7 +1347,6 @@ pub const Directories = struct { |
| 1346 | }; | 1347 | }; |
| 1347 | }; | 1348 | }; |
| 1348 | const build_root: Cache.Directory = if (options.build_root) |s| | 1349 | const build_root: Cache.Directory = if (options.build_root) |s| |
| 1349 | // TODO this ends up setting path to null, leaking the fd in deinit | | |
| 1350 | openUnresolved(arena, io, cwd, s, .@"build root") | 1350 | openUnresolved(arena, io, cwd, s, .@"build root") |
| 1351 | else | 1351 | else |
| 1352 | .cwd(); | 1352 | .cwd(); |