plumber: add -f (foreground) option (#288)

In MacOS, services run by launchd must run in the foreground, since
launchd manages forking and other resources.
This commit is contained in:
Jason Felice 2019-10-29 10:07:10 -04:00 committed by Dan Cross
parent 1309450668
commit b0aecb4ba5
4 changed files with 19 additions and 5 deletions

View file

@ -7,6 +7,7 @@
#include "plumber.h"
int debug;
int foreground=0;
char *plumbfile;
char *user;
char *home;
@ -37,6 +38,9 @@ threadmain(int argc, char *argv[])
case 'd':
debug = 1;
break;
case 'f':
foreground = 1;
break;
case 'p':
plumbfile = ARGF();
break;
@ -69,7 +73,7 @@ threadmain(int argc, char *argv[])
*/
printerrors = 0;
makeports(rules);
startfsys();
startfsys(foreground);
threadexits(nil);
}