aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2018-05-14 19:11:03 +0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2018-05-14 18:01:23 +0200
commitecd5034aca6029c1900f8d681fafb2f5177a7f0b (patch)
tree0ddc9281a67500c906527e866382c1af08313ffc /src
parent02d7a0ee137e192d512b47a73ecf0bc7534c60c0 (diff)
downloadblogc-ecd5034aca6029c1900f8d681fafb2f5177a7f0b.tar.gz
blogc-ecd5034aca6029c1900f8d681fafb2f5177a7f0b.tar.bz2
blogc-ecd5034aca6029c1900f8d681fafb2f5177a7f0b.zip
make: improve blogc output formatting
Diffstat (limited to 'src')
-rw-r--r--src/blogc-make/exec.c59
1 files changed, 28 insertions, 31 deletions
diff --git a/src/blogc-make/exec.c b/src/blogc-make/exec.c
index 49c46a2..df28e5a 100644
--- a/src/blogc-make/exec.c
+++ b/src/blogc-make/exec.c
@@ -308,10 +308,6 @@ bm_exec_blogc(bm_ctx_t *ctx, bc_trie_t *global_variables, bc_trie_t *local_varia
int rv = bm_exec_command(cmd, input->str, &out, &err, &error);
- if (err != NULL) {
- fprintf(stderr, "%s", err);
- }
-
if (error != NULL) {
bc_error_print(error, "blogc-make");
free(cmd);
@@ -322,35 +318,36 @@ bm_exec_blogc(bm_ctx_t *ctx, bc_trie_t *global_variables, bc_trie_t *local_varia
return 3;
}
- if (rv != 0) {
- if (ctx->verbose) {
- fprintf(stderr,
- "blogc-make: error: Failed to execute command.\n"
- "\n"
- "STATUS CODE: %d\n", rv);
- if (input->len > 0) {
- fprintf(stderr, "\nSTDIN:\n"
- "----------------------------->8-----------------------------\n"
- "%s\n"
- "----------------------------->8-----------------------------\n",
- bc_str_strip(input->str));
- }
- if (out != NULL) {
- fprintf(stderr, "\nSTDOUT:\n"
- "----------------------------->8-----------------------------\n"
- "%s\n"
- "----------------------------->8-----------------------------\n",
- bc_str_strip(out));
- }
+ if (rv != 0 && ctx->verbose) {
+ fprintf(stderr,
+ "blogc-make: error: Failed to execute command.\n"
+ "\n"
+ "STATUS CODE: %d\n", rv);
+ if (input->len > 0) {
+ fprintf(stderr, "\nSTDIN:\n"
+ "----------------------------->8-----------------------------\n"
+ "%s\n"
+ "----------------------------->8-----------------------------\n",
+ bc_str_strip(input->str));
}
- else {
- fprintf(stderr,
- "blogc-make: error: Failed to execute command (%d)", rv);
- if (err != NULL) {
- fprintf(stderr, ":\n%s", bc_str_strip(err));
- }
- fprintf(stderr, "\n");
+ if (out != NULL) {
+ fprintf(stderr, "\nSTDOUT:\n"
+ "----------------------------->8-----------------------------\n"
+ "%s\n"
+ "----------------------------->8-----------------------------\n",
+ bc_str_strip(out));
+ }
+ if (err != NULL) {
+ fprintf(stderr, "\nSTDERR:\n"
+ "----------------------------->8-----------------------------\n"
+ "%s\n"
+ "----------------------------->8-----------------------------\n",
+ bc_str_strip(err));
}
+ fprintf(stderr, "\n");
+ }
+ else if (err != NULL) {
+ fprintf(stderr, "%s\n", err);
}
bc_string_free(input, true);