Fix onSignal example
This commit is contained in:
parent
c678ac3f33
commit
21a9fce414
1 changed files with 7 additions and 4 deletions
|
|
@ -962,10 +962,13 @@ 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>".}
|
||||
|
||||
template onSignal*(signals: varargs[cint], body: untyped) =
|
||||
## Setup code to be executed when Unix signals are received. Example:
|
||||
## from posix import SIGINT, SIGTERM
|
||||
## onSignal(SIGINT, SIGTERM):
|
||||
## echo "bye"
|
||||
## Setup code to be executed when Unix signals are received.
|
||||
## Example:
|
||||
##
|
||||
## .. code-block:: nim
|
||||
## from posix import SIGINT, SIGTERM
|
||||
## onSignal(SIGINT, SIGTERM):
|
||||
## echo "bye"
|
||||
|
||||
for s in signals:
|
||||
handle_signal(s,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue