Fix onSignal example

This commit is contained in:
Federico Ceratto 2016-12-31 15:55:34 +00:00 • committed by treeform
commit 21a9fce414

View file

@ -962,7 +962,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: untyped) = template onSignal*(signals: varargs[cint], body: untyped) =
## Setup code to be executed when Unix signals are received. Example: ## Setup code to be executed when Unix signals are received.
## Example:
##
## .. code-block:: nim
## from posix import SIGINT, SIGTERM ## from posix import SIGINT, SIGTERM
## onSignal(SIGINT, SIGTERM): ## onSignal(SIGINT, SIGTERM):
## echo "bye" ## echo "bye"