- /* ignore any SIGPIPE */
- signal(SIGPIPE, SIG_IGN);
-
- /* install trace of requests */
- if (config->tracereq)
- afb_hook_req_create(NULL, NULL, NULL, config->tracereq, NULL, NULL);
-
- /* start the services */
- if (afb_apis_start_all_services(1) < 0)
- exit(1);
-
- /* start the HTTP server */
- if (!config->noHttpd) {
- hsrv = start_http_server();
- if (hsrv == NULL)
- exit(1);
- }
-
- /* run the command */
- if (execute_command() < 0)
- exit(1);
-
- /* signal that ready */
- if (config->readyfd != 0) {
- static const char readystr[] = "READY=1";
- write(config->readyfd, readystr, sizeof(readystr) - 1);
- close(config->readyfd);
- }
-
- // infinite loop
- eventloop = afb_common_get_event_loop();
- sd_notify(1, "READY=1");
- for (;;)
- sd_event_run(eventloop, 30000000);
-
- WARNING("hoops returned from infinite loop [report bug]");