From 7e647c530309ec218403f0b6471da45104a6f9d0 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Wed, 3 Jun 2015 16:37:24 -0700 Subject: [PATCH] NOHUP-ify the child process on OSX auto-update. --- service/OneService.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/service/OneService.cpp b/service/OneService.cpp index 96ab1ac31..1ec619d80 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -259,6 +259,10 @@ public: fclose(bash); long pid = (long)vfork(); if (pid == 0) { + setsid(); // detach from parent so that shell isn't killed when parent is killed + signal(SIGHUP,SIG_IGN); + signal(SIGTERM,SIG_IGN); + signal(SIGQUIT,SIG_IGN); execl("/bin/bash","/bin/bash",bashp,(char *)0); exit(0); }