mirror of
https://github.com/oven-sh/bun
synced 2026-02-12 11:59:00 +00:00
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:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user