Merge branch 'jarred/prepare-for-libuv' of https://github.com/oven-sh/bun into jarred/prepare-for-libuv

This commit is contained in:
Jarred Sumner
2023-09-07 01:53:49 -08:00
2 changed files with 8 additions and 6 deletions

View File

@@ -773,7 +773,7 @@ pub fn openDir(dir: std.fs.Dir, path_: [:0]const u8) !std.fs.IterableDir {
const res = try sys.openDirAtWindowsA(toFD(dir.fd), path_, true, false).unwrap();
return std.fs.IterableDir{ .dir = .{ .fd = fdcast(res) } };
} else {
const fd = try sys.openat(dir.fd, path_, std.os.O.DIRECTORY | std.os.O.CLOEXEC | 0, 0).unwrap();
const fd = try sys.openat(dir.fd, path_, std.os.O.DIRECTORY | std.os.O.CLOEXEC | std.os.O.RDONLY, 0).unwrap();
return std.fs.IterableDir{ .dir = .{ .fd = fd } };
}
}
@@ -783,7 +783,7 @@ pub fn openDirA(dir: std.fs.Dir, path_: []const u8) !std.fs.IterableDir {
const res = try sys.openDirAtWindowsA(toFD(dir.fd), path_, true, false).unwrap();
return std.fs.IterableDir{ .dir = .{ .fd = fdcast(res) } };
} else {
const fd = try sys.openatA(dir.fd, path_, std.os.O.DIRECTORY | std.os.O.CLOEXEC | 0, 0).unwrap();
const fd = try sys.openatA(dir.fd, path_, std.os.O.DIRECTORY | std.os.O.CLOEXEC | std.os.O.RDONLY, 0).unwrap();
return std.fs.IterableDir{ .dir = .{ .fd = fd } };
}
}
@@ -793,7 +793,7 @@ pub fn openDirAbsolute(path_: []const u8) !std.fs.Dir {
const res = try sys.openDirAtWindowsA(invalid_fd, path_, true, false).unwrap();
return std.fs.Dir{ .fd = fdcast(res) };
} else {
const fd = try sys.openA(path_, std.os.O.DIRECTORY | std.os.O.CLOEXEC | 0, 0).unwrap();
const fd = try sys.openA(path_, std.os.O.DIRECTORY | std.os.O.CLOEXEC | std.os.O.RDONLY, 0).unwrap();
return std.fs.Dir{ .fd = fd };
}
}

View File

@@ -7258,9 +7258,11 @@ pub const PackageManager = struct {
const cwd = std.fs.cwd();
var node_modules_folder = cwd.openIterableDir("node_modules", .{}) catch brk: {
skip_verify_installed_version_number = true;
bun.sys.mkdir("node_modules", 0).throw() catch |err| {
Output.prettyErrorln("<r><red>error<r>: <b><red>{s}<r> creating <b>node_modules<r> folder", .{@errorName(err)});
Global.crash();
bun.sys.mkdir("node_modules", 0o755).throw() catch |err| {
if (err != error.EEXIST) {
Output.prettyErrorln("<r><red>error<r>: <b><red>{s}<r> creating <b>node_modules<r> folder", .{@errorName(err)});
Global.crash();
}
};
break :brk cwd.openIterableDir("node_modules", .{}) catch |err| {
Output.prettyErrorln("<r><red>error<r>: <b><red>{s}<r> opening <b>node_modules<r> folder", .{@errorName(err)});