Fix edgecase with socketpair() impacting shell and spawn (#15725)

This commit is contained in:
Jarred Sumner
2024-12-12 01:23:40 -08:00
committed by GitHub
parent fddc28d608
commit 2ccdf0122c
7 changed files with 233 additions and 78 deletions

View File

@@ -439,6 +439,11 @@ pub const StandaloneModuleGraph = struct {
const cleanup = struct {
pub fn toClean(name: [:0]const u8, fd: bun.FileDescriptor) void {
// Ensure we own the file
if (Environment.isPosix) {
// Make the file writable so we can delete it
_ = Syscall.fchmod(fd, 0o777);
}
_ = Syscall.close(fd);
_ = Syscall.unlink(name);
}