From f9a6407111a8730df51258c3b07502814a8ab3e1 Mon Sep 17 00:00:00 2001 From: Brian Ashworth Date: Wed, 1 Aug 2018 23:54:40 -0400 Subject: Show swaynag on config errors --- sway/commands/include.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'sway/commands/include.c') diff --git a/sway/commands/include.c b/sway/commands/include.c index 1ba9a10d..72fec7cc 100644 --- a/sway/commands/include.c +++ b/sway/commands/include.c @@ -7,8 +7,19 @@ struct cmd_results *cmd_include(int argc, char **argv) { return error; } - if (!load_include_configs(argv[0], config)) { - return cmd_results_new(CMD_INVALID, "include", "Failed to include sub configuration file: %s", argv[0]); + char *errors = NULL; + if (!load_include_configs(argv[0], config, &errors)) { + struct cmd_results *result = 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); -- cgit v1.2.3 From a7f7d4a488c8d3b2461122765f9904c8a411a583 Mon Sep 17 00:00:00 2001 From: Brian Ashworth Date: Thu, 2 Aug 2018 21:37:29 -0400 Subject: Write to swaynag pipe fd directly on config errors --- sway/commands/include.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'sway/commands/include.c') diff --git a/sway/commands/include.c b/sway/commands/include.c index 72fec7cc..61f383bb 100644 --- a/sway/commands/include.c +++ b/sway/commands/include.c @@ -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); -- cgit v1.2.3