mirror of
https://github.com/odin-lang/Odin.git
synced 2026-01-06 13:07:59 +00:00
[os2]: Make anonymous pipes always inheritable
This commit is contained in:
@@ -5,7 +5,7 @@ import "core:sys/linux"
|
||||
|
||||
_pipe :: proc() -> (r, w: ^File, err: Error) {
|
||||
fds: [2]linux.Fd
|
||||
errno := linux.pipe2(&fds, {.CLOEXEC})
|
||||
errno := linux.pipe2(&fds, {})
|
||||
if errno != .NONE {
|
||||
return nil, nil,_get_platform_error(errno)
|
||||
}
|
||||
|
||||
@@ -5,7 +5,11 @@ import win32 "core:sys/windows"
|
||||
|
||||
_pipe :: proc() -> (r, w: ^File, err: Error) {
|
||||
p: [2]win32.HANDLE
|
||||
if !win32.CreatePipe(&p[0], &p[1], nil, 0) {
|
||||
sa := win32.SECURITY_ATTRIBUTES {
|
||||
nLength = size_of(win32.SECURITY_ATTRIBUTES),
|
||||
bInheritHandle = true,
|
||||
}
|
||||
if !win32.CreatePipe(&p[0], &p[1], &sa, 0) {
|
||||
return nil, nil, _get_platform_error()
|
||||
}
|
||||
return new_file(uintptr(p[0]), ""), new_file(uintptr(p[1]), ""), nil
|
||||
|
||||
Reference in New Issue
Block a user