io: fix SetHandleInformation signature to match Windows' (#15017)
* io: fix SetHandleInformation signature to match Windows' Fixes #14980 * rename Handle -> IoHandle because system.nim is a mess
This commit is contained in:
parent
b16284633e
commit
bb1adf6a70
1 changed files with 7 additions and 2 deletions
|
|
@ -282,7 +282,11 @@ elif defined(windows):
|
||||||
proc getOsfhandle(fd: cint): int {.
|
proc getOsfhandle(fd: cint): int {.
|
||||||
importc: "_get_osfhandle", header: "<io.h>".}
|
importc: "_get_osfhandle", header: "<io.h>".}
|
||||||
|
|
||||||
proc setHandleInformation(handle: int, mask, flags: culong): cint {.
|
type
|
||||||
|
IoHandle = distinct pointer
|
||||||
|
## Windows' HANDLE type. Defined as an untyped pointer but is **not**
|
||||||
|
## one. Named like this to avoid collision with other `system` modules.
|
||||||
|
proc setHandleInformation(handle: IoHandle, mask, flags: culong): cint {.
|
||||||
importc: "SetHandleInformation", header: "<handleapi.h>".}
|
importc: "SetHandleInformation", header: "<handleapi.h>".}
|
||||||
|
|
||||||
const
|
const
|
||||||
|
|
@ -339,7 +343,8 @@ when defined(nimdoc) or (defined(posix) and not defined(nimscript)) or defined(w
|
||||||
flags = if inheritable: flags and not FD_CLOEXEC else: flags or FD_CLOEXEC
|
flags = if inheritable: flags and not FD_CLOEXEC else: flags or FD_CLOEXEC
|
||||||
result = c_fcntl(f, F_SETFD, flags) != -1
|
result = c_fcntl(f, F_SETFD, flags) != -1
|
||||||
else:
|
else:
|
||||||
result = setHandleInformation(f.int, HANDLE_FLAG_INHERIT, culong inheritable) != 0
|
result = setHandleInformation(cast[IoHandle](f), HANDLE_FLAG_INHERIT,
|
||||||
|
culong inheritable) != 0
|
||||||
|
|
||||||
proc readLine*(f: File, line: var TaintedString): bool {.tags: [ReadIOEffect],
|
proc readLine*(f: File, line: var TaintedString): bool {.tags: [ReadIOEffect],
|
||||||
benign.} =
|
benign.} =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue