From 2870751be3f8874378f1a383e6d264b87195580d Mon Sep 17 00:00:00 2001 From: BanceDev Date: Thu, 12 Sep 2024 09:13:01 -0400 Subject: added e2e testing to cover basic shell functionality --- src/lua_api.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/lua_api.c') diff --git a/src/lua_api.c b/src/lua_api.c index 20f089c..77417db 100644 --- a/src/lua_api.c +++ b/src/lua_api.c @@ -94,8 +94,11 @@ void lua_run_init(lua_State *L) { // -- C funtions -- static int execute_command(lua_State *L, const char *line) { int status = 0; - char **commands = lush_split_pipes((char *)line); + lush_push_history(line); + char *expanded_line = lush_resolve_aliases((char *)line); + char **commands = lush_split_pipes(expanded_line); char ***args = lush_split_args(commands, &status); + if (status == -1) { fprintf(stderr, "lush: Expected end of quoted string\n"); } else if (lush_run(L, args, status) == 0) { @@ -105,7 +108,6 @@ static int execute_command(lua_State *L, const char *line) { for (int i = 0; args[i]; i++) { free(args[i]); } - lush_push_history(line); free(args); free(commands); return status; -- cgit v1.2.3-59-g8ed1b