about summary refs log tree commit diff stats
path: root/src/loader/cgi.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-03-24 16:09:10 +0100
committerbptato <nincsnevem662@gmail.com>2024-03-24 16:09:10 +0100
commitd01670fd68c89a5ad39396e47155f2009d697578 (patch)
treee93f3c4468f660848420208ee8d36ba92ecdfead /src/loader/cgi.nim
parentac7a51dbd9652e7a90b1a273a1a08c536f0f1331 (diff)
downloadchawan-d01670fd68c89a5ad39396e47155f2009d697578.tar.gz
cgi: reset SIGCHLD handler in children
this was causing problems in git.cgi
Diffstat (limited to 'src/loader/cgi.nim')
-rw-r--r--src/loader/cgi.nim4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/loader/cgi.nim b/src/loader/cgi.nim
index 7d08f4a2..8d6d60b3 100644
--- a/src/loader/cgi.nim
+++ b/src/loader/cgi.nim
@@ -205,6 +205,10 @@ proc loadCGI*(handle: LoaderHandle; request: Request; cgiDir: seq[string];
     # we leave stderr open, so it can be seen in the browser console
     setupEnv(cmd, scriptName, pathInfo, requestURI, myDir, request, contentLen,
       prevURL)
+    # reset SIGCHLD to the default handler. this is useful if the child process
+    # expects SIGCHLD to be untouched. (e.g. git dies a horrible death with
+    # SIGCHLD as SIG_IGN)
+    signal(SIGCHLD, SIG_DFL)
     discard execl(cstring(cmd), cstring(basename), nil)
     let code = int(ERROR_FAILED_TO_EXECUTE_CGI_SCRIPT)
     stdout.write("Cha-Control: ConnectionError " & $code & " " &