summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2015-06-03 16:37:24 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2015-06-03 16:37:24 -0700
commit7e647c530309ec218403f0b6471da45104a6f9d0 (patch)
tree6edbd4d8f4bb5ab04226021ca8c5fabfeab37758
parentfe87136870968472f7b50727d726eb3c1111ca0f (diff)
downloadinfinitytier-7e647c530309ec218403f0b6471da45104a6f9d0.tar.gz
infinitytier-7e647c530309ec218403f0b6471da45104a6f9d0.zip
NOHUP-ify the child process on OSX auto-update.
-rw-r--r--service/OneService.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/service/OneService.cpp b/service/OneService.cpp
index 96ab1ac3..1ec619d8 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);
}