nim-stew/stew/shims/os.nim

19 lines
470 B
Nim
Raw Normal View History

2019-07-07 09:38:00 +00:00
import std/os
export os
when defined(windows):
import winlean
else:
import posix
2019-05-08 20:05:16 +00:00
when not declared(getCurrentProcessId):
proc getCurrentProcessId*(): int =
## return current process ID. See also ``osproc.processID(p: Process)``.
when defined(windows):
proc GetCurrentProcessId(): DWORD {.stdcall, dynlib: "kernel32",
importc: "GetCurrentProcessId".}
2019-05-08 20:05:16 +00:00
GetCurrentProcessId().int
else:
getpid()