Write to swaynag pipe fd directly on config errors

This commit is contained in:
Brian Ashworth 2018-08-02 21:37:29 -04:00
parent f9a6407111
commit a7f7d4a488
12 changed files with 227 additions and 110 deletions

View file

@ -7,19 +7,10 @@ struct cmd_results *cmd_include(int argc, char **argv) {
return error;
}
char *errors = NULL;
if (!load_include_configs(argv[0], config, &errors)) {
struct cmd_results *result = cmd_results_new(CMD_INVALID, "include",
if (!load_include_configs(argv[0], config,
&config->swaynag_config_errors)) {
return cmd_results_new(CMD_INVALID, "include",
"Failed to include sub configuration file: %s", argv[0]);
free(errors);
return result;
}
if (errors) {
struct cmd_results *result = cmd_results_new(CMD_INVALID, "include",
"There are errors in the included config\n%s", errors);
free(errors);
return result;
}
return cmd_results_new(CMD_SUCCESS, NULL, NULL);