diff options
author | bptato <nincsnevem662@gmail.com> | 2025-02-05 20:25:53 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2025-02-05 20:41:58 +0100 |
commit | 03b1412771dd1d03676ec546b12432c352b88e4e (patch) | |
tree | de7ecc004f8a62af43e14cd3110758066a103d29 /src/main.nim | |
parent | 7f6cc3dc7d7f1c46dc56c7432244fca57a63a732 (diff) | |
download | chawan-03b1412771dd1d03676ec546b12432c352b88e4e.tar.gz |
pager: catch SIGINT for interrupt handler
Significantly more efficient in long running commands (as the context switch is gone). For many commands in quick succession... it replaces the fcntl with a tcsetattr, so I guess it's the same?
Diffstat (limited to 'src/main.nim')
-rw-r--r-- | src/main.nim | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main.nim b/src/main.nim index e5d8d89b..54973779 100644 --- a/src/main.nim +++ b/src/main.nim @@ -275,7 +275,12 @@ proc main() = # make sure tmpdir exists discard mkdir(cstring(config.external.tmpdir), 0o700) let loaderPid = forkserver.loadConfig(config) - #setControlCHook(proc() {.noconv.} = quit(1)) + onSignal SIGINT: + discard sig + if acceptSigint: + sigintCaught = true + else: + quit(1) let loaderControl = newSocketStream(loaderSockVec[0]) loaderControl.setCloseOnExec() let client = newClient(config, forkserver, loaderPid, jsctx, warnings, |