about summary refs log tree commit diff stats
path: root/src/display/client.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-06-25 22:53:57 +0200
committerbptato <nincsnevem662@gmail.com>2023-06-26 00:46:53 +0200
commitd0c4570fffec4c4d9db909f59b7f70c89e012acf (patch)
tree2657c9686c2854f5cc2a5486a80b88a788b2266d /src/display/client.nim
parent0524bed395cfeb467812854c55673c8dc87a1bde (diff)
downloadchawan-d0c4570fffec4c4d9db909f59b7f70c89e012acf.tar.gz
Fix crash in openEditor if SIGINT was delivered
nvi for example sets ISIG and traps SIGINT.
Without this patch, this would propagate to all processes in the same
process group and kill them. (It still does, but we set a signalHandler
to ignore that.)

Still not perfect, because for some reason we receive WIFSIGNALED even
if the signal did not actually kill the editor. For now, we just treat
this as a success.
Diffstat (limited to 'src/display/client.nim')
-rw-r--r--src/display/client.nim1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/display/client.nim b/src/display/client.nim
index 81d400b1..49dae2ea 100644
--- a/src/display/client.nim
+++ b/src/display/client.nim
@@ -537,6 +537,7 @@ proc sleep(client: Client, millis: int) {.jsfunc.} =
 
 proc newClient*(config: Config, dispatcher: Dispatcher): Client =
   new(result)
+  setControlCHook(proc() {.noconv.} = quit(1))
   result.config = config
   result.dispatcher = dispatcher
   result.attrs = getWindowAttributes(stdout)