| ... | @@ -485,7 +485,7 @@ pub const ChildProcess = struct { | ... | @@ -485,7 +485,7 @@ pub const ChildProcess = struct { |
| 485 | const any_ignore = (self.stdin_behavior == StdIo.Ignore or self.stdout_behavior == StdIo.Ignore or self.stderr_behavior == StdIo.Ignore); | 485 | const any_ignore = (self.stdin_behavior == StdIo.Ignore or self.stdout_behavior == StdIo.Ignore or self.stderr_behavior == StdIo.Ignore); |
| 486 | | 486 | |
| 487 | const nul_handle = if (any_ignore) | 487 | const nul_handle = if (any_ignore) |
| 488 | // "\Device\Null" or "\??\NUL" | 488 | // "\Device\Null" or "\??\NUL" |
| 489 | windows.OpenFile(&[_]u16{ '\\', 'D', 'e', 'v', 'i', 'c', 'e', '\\', 'N', 'u', 'l', 'l' }, .{ | 489 | windows.OpenFile(&[_]u16{ '\\', 'D', 'e', 'v', 'i', 'c', 'e', '\\', 'N', 'u', 'l', 'l' }, .{ |
| 490 | .access_mask = windows.GENERIC_READ | windows.SYNCHRONIZE, | 490 | .access_mask = windows.GENERIC_READ | windows.SYNCHRONIZE, |
| 491 | .share_access = windows.FILE_SHARE_READ, | 491 | .share_access = windows.FILE_SHARE_READ, |
| ... | @@ -816,6 +816,13 @@ fn destroyPipe(pipe: [2]os.fd_t) void { | ... | @@ -816,6 +816,13 @@ fn destroyPipe(pipe: [2]os.fd_t) void { |
| 816 | // Then the child exits. | 816 | // Then the child exits. |
| 817 | fn forkChildErrReport(fd: i32, err: ChildProcess.SpawnError) noreturn { | 817 | fn forkChildErrReport(fd: i32, err: ChildProcess.SpawnError) noreturn { |
| 818 | writeIntFd(fd, @as(ErrInt, @errorToInt(err))) catch {}; | 818 | writeIntFd(fd, @as(ErrInt, @errorToInt(err))) catch {}; |
| | 819 | // If we're linking libc, some naughty applications may have registered atexit handlers |
| | 820 | // which we really do not want to run in the fork child. I caught LLVM doing this and |
| | 821 | // it caused a deadlock instead of doing an exit syscall. In the words of Avril Lavigne, |
| | 822 | // "Why'd you have to go and make things so complicated?" |
| | 823 | if (std.Target.current.os.tag == .linux) { |
| | 824 | std.os.linux.exit(1); // By-pass libc regardless of whether it is linked. |
| | 825 | } |
| 819 | os.exit(1); | 826 | os.exit(1); |
| 820 | } | 827 | } |
| 821 | | 828 | |