From b379b400718c05ce6cd43550b78704a2938a47c0 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 22 Nov 2017 21:39:35 -0500 Subject: [PATCH] Invoke command handlers once parsed --- sway/commands.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sway/commands.c b/sway/commands.c index f8c2fd99..94a45253 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -177,6 +177,16 @@ struct cmd_results *handle_command(char *_exec) { free_argv(argc, argv); goto cleanup; } + struct cmd_results *res = handler->handle(argc-1, argv+1); + if (res->status != CMD_SUCCESS) { + free_argv(argc, argv); + if (results) { + free_cmd_results(results); + } + results = res; + goto cleanup; + } + free_cmd_results(res); free_argv(argc, argv); } while(cmdlist); } while(head);