diff options
author | Wojtek Kosior <koszko@koszko.org> | 2021-07-22 14:42:58 +0200 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2021-07-22 14:42:58 +0200 |
commit | b6ace6eda12140c29ee58ec9178b9212b21fa538 (patch) | |
tree | 61f278c90c4d96e9fe686230442d7993b1949890 /main.c | |
parent | 91d4ce9f14668a5a04b51158b1921e83d51ba9a0 (diff) | |
download | hydrilla-b6ace6eda12140c29ee58ec9178b9212b21fa538.tar.gz hydrilla-b6ace6eda12140c29ee58ec9178b9212b21fa538.zip |
add option to wait for termination by SIGTERM instead of by stdin input
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -13,6 +13,7 @@ #include <sys/stat.h> #include <fcntl.h> #include <string.h> +#include <stdlib.h> #include <cjson/cJSON.h> @@ -155,7 +156,7 @@ static void print_component_name(const void *key, void *val, void *arg) unfilled ? " (referenced only)" : ""); } -int serve_scriptbase(struct scriptbase *base); +int serve_scriptbase(struct scriptbase *base, bool); int main(int argc, char *argv[]) { @@ -174,7 +175,7 @@ int main(int argc, char *argv[]) puts("## LOADED PAGES:"); ht_map(&base.pages, (void*) 'p', print_component_name); - if (serve_scriptbase(&base)) + if (serve_scriptbase(&base, !!getenv("HYDRILLA_WAIT_SIGTERM"))) fprintf(stderr, "Error serving scriptbase.\n"); scriptbase_destroy(&base); |