aboutsummaryrefslogtreecommitdiffstats
path: root/src/blogc-make
diff options
context:
space:
mode:
Diffstat (limited to 'src/blogc-make')
-rw-r--r--src/blogc-make/reloader.c9
-rw-r--r--src/blogc-make/reloader.h5
-rw-r--r--src/blogc-make/rules.c2
3 files changed, 11 insertions, 5 deletions
diff --git a/src/blogc-make/reloader.c b/src/blogc-make/reloader.c
index 0832ae8..a4b837d 100644
--- a/src/blogc-make/reloader.c
+++ b/src/blogc-make/reloader.c
@@ -30,7 +30,7 @@ bm_reloader_thread(void *arg)
"reloader disabled!\n");
break;
}
- if (0 != reloader->rule_exec(reloader->ctx, NULL, NULL)) {
+ if (0 != reloader->rule_exec(reloader->ctx, reloader->outputs, reloader->args)) {
fprintf(stderr, "blogc-make: error: failed to rebuild website. "
"reloader disabled!\n");
break;
@@ -44,10 +44,11 @@ bm_reloader_thread(void *arg)
bm_reloader_t*
-bm_reloader_new(bm_ctx_t *ctx, bm_rule_exec_func_t rule_exec)
+bm_reloader_new(bm_ctx_t *ctx, bm_rule_exec_func_t rule_exec,
+ bc_slist_t *outputs, bc_trie_t *args)
{
// first rule_exec call is syncronous, to do a 'sanity check'
- if (0 != rule_exec(ctx, NULL, NULL))
+ if (0 != rule_exec(ctx, outputs, args))
return NULL;
int err;
@@ -70,6 +71,8 @@ bm_reloader_new(bm_ctx_t *ctx, bm_rule_exec_func_t rule_exec)
bm_reloader_t *rv = bc_malloc(sizeof(bm_reloader_t));
rv->ctx = ctx;
rv->rule_exec = rule_exec;
+ rv->outputs = outputs;
+ rv->args = args;
rv->running = true;
pthread_t thread;
diff --git a/src/blogc-make/reloader.h b/src/blogc-make/reloader.h
index 70464a8..d688ccf 100644
--- a/src/blogc-make/reloader.h
+++ b/src/blogc-make/reloader.h
@@ -16,10 +16,13 @@
typedef struct {
bm_ctx_t *ctx;
bm_rule_exec_func_t rule_exec;
+ bc_slist_t *outputs;
+ bc_trie_t *args;
bool running;
} bm_reloader_t;
-bm_reloader_t* bm_reloader_new(bm_ctx_t *ctx, bm_rule_exec_func_t rule_exec);
+bm_reloader_t* bm_reloader_new(bm_ctx_t *ctx, bm_rule_exec_func_t rule_exec,
+ bc_slist_t *outputs, bc_trie_t *args);
void bm_reloader_stop(bm_reloader_t *reloader);
#endif /* _MAKE_RELOADER_H */
diff --git a/src/blogc-make/rules.c b/src/blogc-make/rules.c
index 1f4a121..ca4b376 100644
--- a/src/blogc-make/rules.c
+++ b/src/blogc-make/rules.c
@@ -553,7 +553,7 @@ static int all_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args);
static int
runserver_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args)
{
- bm_reloader_t *reloader = bm_reloader_new(ctx, all_exec);
+ bm_reloader_t *reloader = bm_reloader_new(ctx, all_exec, outputs, args);
int rv = bm_exec_blogc_runserver(ctx, bc_trie_lookup(args, "host"),
bc_trie_lookup(args, "port"), bc_trie_lookup(args, "threads"));