fix: use cross-platform File.writeFile for Windows compatibility

Replace custom writePackageJSONToDisk with bun.sys.File.writeFile which
handles open/write/truncate/close in a single cross-platform operation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Claude Bot
2025-12-17 01:00:50 +00:00
parent 2525a9e5c3
commit a10785b45b

View File

@@ -1,16 +1,5 @@
/// Helper to write package.json content to disk.
/// Opens the file, writes the content, truncates to the exact length, and closes.
fn writePackageJSONToDisk(path: [:0]const u8, content: []const u8) !void {
const file = (try bun.sys.File.openat(
.cwd(),
path,
bun.O.RDWR,
0,
).unwrap()).handle.stdFile();
try file.pwriteAll(content, 0);
std.posix.ftruncate(file.handle, content.len) catch {};
file.close();
try bun.sys.File.writeFile(bun.FD.cwd(), path, content).unwrap();
}
pub fn updatePackageJSONAndInstallWithManager(