summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--discover/boot.c3
-rw-r--r--discover/paths.c13
-rw-r--r--discover/paths.h5
-rw-r--r--discover/pxe-parser.c5
-rw-r--r--test/parser/utils.c7
5 files changed, 26 insertions, 7 deletions
diff --git a/discover/boot.c b/discover/boot.c
index 5347fd7..da7b946 100644
--- a/discover/boot.c
+++ b/discover/boot.c
@@ -522,7 +522,8 @@ static int start_url_load(struct boot_task *task, const char *name,
if (!url)
return 0;
- *result = load_url_async(task, url, boot_process, task);
+ *result = load_url_async(task, url, boot_process, task, NULL,
+ task->status_arg);
if (!*result) {
update_status(task->status_fn, task->status_arg,
STATUS_ERROR, _("Error loading %s"), name);
diff --git a/discover/paths.c b/discover/paths.c
index 8d85619..ad42b5b 100644
--- a/discover/paths.c
+++ b/discover/paths.c
@@ -370,7 +370,8 @@ static void load_local(struct load_task *task)
*/
struct load_url_result *load_url_async(void *ctx, struct pb_url *url,
- load_url_complete async_cb, void *async_data)
+ load_url_complete async_cb, void *async_data,
+ waiter_cb stdout_cb, void *stdout_data)
{
struct load_url_result *result;
struct load_task *task;
@@ -390,6 +391,14 @@ struct load_url_result *load_url_async(void *ctx, struct pb_url *url,
task->async_data = async_data;
task->process->exit_cb = load_url_process_exit;
task->process->data = task;
+ task->process->stdout_cb = stdout_cb;
+ task->process->stdout_data = stdout_data;
+ }
+
+ /* Make sure we save output for any task that has a custom handler */
+ if (task->process->stdout_cb) {
+ task->process->add_stderr = true;
+ task->process->keep_stdout = true;
}
switch (url->scheme) {
@@ -430,7 +439,7 @@ struct load_url_result *load_url_async(void *ctx, struct pb_url *url,
struct load_url_result *load_url(void *ctx, struct pb_url *url)
{
- return load_url_async(ctx, url, NULL, NULL);
+ return load_url_async(ctx, url, NULL, NULL, NULL, NULL);
}
void load_url_async_cancel(struct load_url_result *res)
diff --git a/discover/paths.h b/discover/paths.h
index 191b8dc..35673b7 100644
--- a/discover/paths.h
+++ b/discover/paths.h
@@ -2,6 +2,8 @@
#define PATHS_H
#include <url/url.h>
+#include <waiter/waiter.h>
+#include <process/process.h>
/**
* Utility function for joining two paths. Adds a / between a and b if
@@ -43,7 +45,8 @@ typedef void (*load_url_complete)(struct load_url_result *result, void *data);
/* Load a (potentially remote) file, and return a guaranteed-local name */
struct load_url_result *load_url_async(void *ctx, struct pb_url *url,
- load_url_complete complete, void *data);
+ load_url_complete complete, void *data,
+ waiter_cb stdout_cb, void *stdout_data);
/* Cancel a pending load */
void load_url_async_cancel(struct load_url_result *res);
diff --git a/discover/pxe-parser.c b/discover/pxe-parser.c
index 046addb..b51511a 100644
--- a/discover/pxe-parser.c
+++ b/discover/pxe-parser.c
@@ -227,7 +227,8 @@ static void pxe_load_next_filename(struct conf_context *conf)
if (!url)
continue;
- if (load_url_async(conf, url, pxe_conf_parse_cb, conf))
+ if (load_url_async(conf, url, pxe_conf_parse_cb, conf,
+ NULL, NULL))
break;
}
@@ -380,7 +381,7 @@ static int pxe_parse(struct discover_context *dc)
/* we have a complete URL; use this and we're done. */
result = load_url_async(conf->dc, conf->dc->conf_url,
- pxe_conf_parse_cb, conf);
+ pxe_conf_parse_cb, conf, NULL, ctx);
if (!result) {
pb_log("load_url_async fails for %s\n",
dc->conf_url->path);
diff --git a/test/parser/utils.c b/test/parser/utils.c
index 9d40d2b..8900bd7 100644
--- a/test/parser/utils.c
+++ b/test/parser/utils.c
@@ -310,7 +310,8 @@ int parser_replace_file(struct discover_context *ctx,
}
struct load_url_result *load_url_async(void *ctx, struct pb_url *url,
- load_url_complete async_cb, void *async_data)
+ load_url_complete async_cb, void *async_data,
+ waiter_cb stdout_cb, void *stdout_data)
{
struct conf_context *conf = async_data;
struct parser_test *test = conf->dc->test_data;
@@ -320,6 +321,10 @@ struct load_url_result *load_url_async(void *ctx, struct pb_url *url,
struct test_file *file;
int fd;
+ /* Ignore the stdout callback for tests */
+ (void)stdout_cb;
+ (void)stdout_data;
+
fd = mkstemp(tmp);
if (fd < 0)
OpenPOWER on IntegriCloud