diff options
author | Federico Ceratto <federico.ceratto@gmail.com> | 2016-12-31 15:55:34 +0000 |
---|---|---|
committer | treeform <starplant@gmail.com> | 2017-12-14 18:36:18 +0000 |
commit | 21a9fce4142dca497b1e7c85b35479aba5f47a8c (patch) | |
tree | 6939b2e46bc5ac0e771321169580a0364d697a67 /lib | |
parent | c678ac3f33d67cf39df777ca2c8440a6cabcc0b7 (diff) | |
download | Nim-21a9fce4142dca497b1e7c85b35479aba5f47a8c.tar.gz |
Fix onSignal example
Diffstat (limited to 'lib')
-rw-r--r-- | lib/posix/posix.nim | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/posix/posix.nim b/lib/posix/posix.nim index b635c0b0b..a73b6090e 100644 --- a/lib/posix/posix.nim +++ b/lib/posix/posix.nim @@ -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, |