diff options
author | nblaxall <43897322+nblaxall@users.noreply.github.com> | 2022-01-20 00:25:21 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-19 12:25:21 +0100 |
commit | 23c4bbedcbf12a7ab87baefe589b472837d89dbf (patch) | |
tree | 518dfecf796aeb8ddfb837ad9db66faf61e7e79e /lib | |
parent | b3c178c2024f679a83275f63ca9e21a8b5ba73d7 (diff) | |
download | Nim-23c4bbedcbf12a7ab87baefe589b472837d89dbf.tar.gz |
add an example to setControlCHook (#19416)
* add an example to setControlCHook * [skip CI] format example for setControlCHook Co-authored-by: Nathan Blaxall <nathan.blaxall@actionstep.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/system.nim | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/system.nim b/lib/system.nim index 02da048e4..09de9fcde 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -2319,6 +2319,15 @@ when notJSnotNims: proc setControlCHook*(hook: proc () {.noconv.}) ## Allows you to override the behaviour of your application when CTRL+C ## is pressed. Only one such hook is supported. + ## Example: + ## + ## .. code-block:: Nim + ## proc ctrlc() {.noconv.} = + ## echo "Ctrl+C fired!" + ## # do clean up stuff + ## quit() + ## + ## setControlCHook(ctrlc) when not defined(noSignalHandler) and not defined(useNimRtl): proc unsetControlCHook*() |