aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2016-12-27 23:02:48 +0100
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2016-12-27 23:02:48 +0100
commit7e6c2732bcec600e6496d4cb1587927ae1937cb5 (patch)
treefe957f1cc9f458f5fe8755c56ba6db1fee63ec55
parent6974c7030339b0e07086d8a34548396313725346 (diff)
downloadblogc-7e6c2732bcec600e6496d4cb1587927ae1937cb5.tar.gz
blogc-7e6c2732bcec600e6496d4cb1587927ae1937cb5.tar.bz2
blogc-7e6c2732bcec600e6496d4cb1587927ae1937cb5.zip
make: provide useful info if blogc-runserver not found
-rw-r--r--src/blogc-make/exec.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/blogc-make/exec.c b/src/blogc-make/exec.c
index 28dc73d..bb8a7b7 100644
--- a/src/blogc-make/exec.c
+++ b/src/blogc-make/exec.c
@@ -263,7 +263,7 @@ bm_exec_blogc(bm_settings_t *settings, bc_trie_t *variables, bool listing,
if (rv != 0) {
if (verbose) {
fprintf(stderr,
- "error: Failed to execute command.\n"
+ "blogc-make: error: Failed to execute command.\n"
"\n"
"STATUS CODE: %d\n", rv);
if (input->len > 0) {
@@ -290,8 +290,8 @@ bm_exec_blogc(bm_settings_t *settings, bc_trie_t *variables, bool listing,
}
else {
fprintf(stderr,
- "error: Failed to execute command, returned status code: %d\n",
- rv);
+ "blogc-make: error: Failed to execute command, returned "
+ "status code: %d\n", rv);
}
}
@@ -324,12 +324,21 @@ bm_exec_blogc_runserver(bm_settings_t *settings, bool verbose)
fflush(stdout);
// we don't need pipes to run blogc-runserver, because it is "interactive"
- int rv = system(cmd);
+ int rv = WEXITSTATUS(system(cmd));
free(cmd);
- if (rv != 0)
- fprintf(stderr,
- "error: Failed to execute command, returned status code: %d\n", rv);
+ if (rv != 0) {
+ if (rv == 127) {
+ fprintf(stderr,
+ "blogc-make: error: blogc-runserver command not found. Maybe "
+ "it is not installed?\n");
+ }
+ else {
+ fprintf(stderr,
+ "blogc-make: error: Failed to execute command, returned "
+ "status code: %d\n", rv);
+ }
+ }
return rv;
}