forked from cory/tildefriends
Added some questionable support for running everything in one process, because iOS.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4520 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
@ -320,6 +320,7 @@ typedef struct tf_run_args_t {
|
||||
int count;
|
||||
const char* args;
|
||||
const char* zip;
|
||||
bool one_proc;
|
||||
bool help;
|
||||
} tf_run_args_t;
|
||||
|
||||
@ -341,6 +342,7 @@ static int _tf_run_task(const tf_run_args_t* args, int index)
|
||||
tf_task_set_http_port(task, args->http_port ? args->http_port + index : 0);
|
||||
tf_task_set_https_port(task, args->https_port ? args->https_port + index : 0);
|
||||
tf_task_set_args(task, args->args);
|
||||
tf_task_set_one_proc(task, args->one_proc);
|
||||
const char* db_path = args->db_path;
|
||||
char db_path_buffer[256];
|
||||
if (index)
|
||||
@ -385,6 +387,7 @@ static int _tf_command_run(const char* file, int argc, char* argv[])
|
||||
{ "db-path", 'd', offsetof(tf_run_args_t, db_path), NULL, XOPT_TYPE_STRING, NULL, "Sqlite database path (default: db.sqlite)." },
|
||||
{ "count", 'n', offsetof(tf_run_args_t, count), NULL, XOPT_TYPE_INT, NULL, "Number of instances to run." },
|
||||
{ "args", 'a', offsetof(tf_run_args_t, args), NULL, XOPT_TYPE_STRING, NULL, "Arguments of the form key=value,foo=bar,verbose=true." },
|
||||
{ "one-proc", 'o', offsetof(tf_run_args_t, one_proc), NULL, XOPT_TYPE_BOOL, NULL, "Run everything in one process (unsafely!)." },
|
||||
{ "zip", 'z', offsetof(tf_run_args_t, zip), NULL, XOPT_TYPE_STRING, NULL, "Zip archive from which to load files." },
|
||||
{ "help", 'h', offsetof(tf_run_args_t, help), NULL, XOPT_TYPE_BOOL, NULL, "Shows this help message." },
|
||||
XOPT_NULLOPTION,
|
||||
@ -485,7 +488,7 @@ static int _tf_command_sandbox(const char* file, int argc, char* argv[])
|
||||
prctl(PR_SET_PDEATHSIG, SIGHUP);
|
||||
#endif
|
||||
tf_task_t* task = tf_task_create();
|
||||
tf_task_configure_from_stdin(task);
|
||||
tf_task_configure_from_fd(task, STDIN_FILENO);
|
||||
shedPrivileges();
|
||||
/* The caller will trigger tf_task_activate with a message. */
|
||||
tf_task_run(task);
|
||||
|
Reference in New Issue
Block a user