From cb6b3c47dc5c3cb4ab391a082fe0666066fdd4f4 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sun, 14 May 2023 18:40:11 +0200 Subject: process: add process_output_dump --- src/process.c | 9 +++++++++ src/process.h | 2 ++ src/worker.c | 7 +------ 3 files changed, 12 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/process.c b/src/process.c index bff9772..c0888b4 100644 --- a/src/process.c +++ b/src/process.c @@ -137,3 +137,12 @@ void proc_output_free(const struct proc_output *output) { free(output->output); } + +void proc_output_dump(const struct proc_output *output) +{ + log("Process exit code: %d\n", output->ec); + log("Process output:\n%s", output->output); + if (!output->output || !output->output_len || + output->output[output->output_len - 1] != '\n') + log("\n"); +} diff --git a/src/process.h b/src/process.h index 7f22a88..5726fd3 100644 --- a/src/process.h +++ b/src/process.h @@ -28,4 +28,6 @@ int proc_capture(const char *args[], const char *envp[], struct proc_output *res void proc_output_init(struct proc_output *); void proc_output_free(const struct proc_output *); +void proc_output_dump(const struct proc_output *); + #endif diff --git a/src/worker.c b/src/worker.c index 755ff35..b792ac7 100644 --- a/src/worker.c +++ b/src/worker.c @@ -95,12 +95,7 @@ static int msg_ci_run_do(const char *url, const char *rev, struct proc_output *r return ret; } - log("Process exit code: %d\n", result->ec); - log("Process output:\n%s", result->output); - if (!result->output || !result->output_len || - result->output[result->output_len - 1] != '\n') - log("\n"); - + proc_output_dump(result); return 0; } -- cgit v1.2.3