diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2023-05-14 18:40:11 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2023-05-14 18:41:32 +0200 |
commit | cb6b3c47dc5c3cb4ab391a082fe0666066fdd4f4 (patch) | |
tree | 315e9324d82ffae8e64c846585c94928406c0eb5 /src | |
parent | msg: add functions for one-off communication (diff) | |
download | cimple-cb6b3c47dc5c3cb4ab391a082fe0666066fdd4f4.tar.gz cimple-cb6b3c47dc5c3cb4ab391a082fe0666066fdd4f4.zip |
process: add process_output_dump
Diffstat (limited to 'src')
-rw-r--r-- | src/process.c | 9 | ||||
-rw-r--r-- | src/process.h | 2 | ||||
-rw-r--r-- | src/worker.c | 7 |
3 files changed, 12 insertions, 6 deletions
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; } |