Update posix.nim
This commit is contained in:
parent
8b1faad5a7
commit
6d256ba76e
1 changed files with 2 additions and 2 deletions
|
|
@ -2630,10 +2630,10 @@ proc utimes*(path: cstring, times: ptr array [2, Timeval]): int {.
|
||||||
|
|
||||||
proc handle_signal(sig: cint, handler: proc (a: cint) {.noconv.}) {.importc: "signal", header: "<signal.h>".}
|
proc handle_signal(sig: cint, handler: proc (a: cint) {.noconv.}) {.importc: "signal", header: "<signal.h>".}
|
||||||
|
|
||||||
template onSignal*(signals: varargs[cint], body: stmt): stmt {.immediate.} =
|
template onSignal*(signals: varargs[cint], body: untyped): stmt =
|
||||||
## Setup code to be executed when Unix signals are received. Example:
|
## Setup code to be executed when Unix signals are received. Example:
|
||||||
## from posix import SIGINT, SIGTERM
|
## from posix import SIGINT, SIGTERM
|
||||||
## onSignal([SIGINT, SIGTERM]):
|
## onSignal(SIGINT, SIGTERM):
|
||||||
## echo "bye"
|
## echo "bye"
|
||||||
|
|
||||||
for s in signals:
|
for s in signals:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue