commit fa1cd1d694185c9c38e5fe61059dc4ba8715b585
parent f3885ee60daed0edd4006cac44bdbe170e8b7957
Author: Mohamed Aslan <maslan@sce.carleton.ca>
Date: Mon, 26 May 2014 13:53:36 -0400
fix text editor not found bug
Diffstat:
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/cmd-commit.c b/cmd-commit.c
@@ -136,15 +136,16 @@ cmd_commit(int argc, char **argv)
if (flag_msg) {
/* TODO: should be per-stage file */
if (gen_temp_msgfile_from_msg(s.repo_baselinedir, &msg_file, commit_msg) == EXIT_FAILURE)
- errx(EXIT_FAILURE, "error, failed to generate commit message");
+ errx(EXIT_FAILURE, "error, failed to generate commit message.");
free(commit_msg);
}
else {
if (gen_temp_msgfile(s.repo_baselinedir, &msg_file) == EXIT_FAILURE)
- errx(EXIT_FAILURE, "error, failed to generate commit message");
+ errx(EXIT_FAILURE, "error, failed to generate commit message.");
if((editor = baseline_config_get_val("editor")) != NULL && strcmp(editor, "")) {
asprintf(&exec, "%s %s", editor, msg_file);
- system(exec);
+ if (system(exec) != EXIT_SUCCESS)
+ errx(EXIT_FAILURE, "error, failed to launch \'%s\' text editor.", editor);
free(exec);
}
else if ((editor = getenv("EDITOR")) != NULL) {
@@ -157,7 +158,7 @@ cmd_commit(int argc, char **argv)
}
}
if (process_msgfile(s.repo_baselinedir, &msg_file) == EXIT_FAILURE)
- errx(EXIT_FAILURE, "error, failed to process commit message");
+ errx(EXIT_FAILURE, "error, failed to process commit message.");
if (s.dc_ops->commit(s.dc_ctx, msg_file) == EXIT_FAILURE)
fprintf(stderr, "baseline: error, failed to commit your changes.\n");