aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua_api.c
diff options
context:
space:
mode:
authorGravatar BanceDev 2024-09-12 09:13:01 -0400
committerGravatar BanceDev 2024-09-12 09:13:01 -0400
commit2870751be3f8874378f1a383e6d264b87195580d (patch)
treef4a2d13121723140cd44bebc69b01c7db48a6c21 /src/lua_api.c
parentupdated buffer size for date to account for compiler warning (diff)
added e2e testing to cover basic shell functionality
Diffstat (limited to 'src/lua_api.c')
-rw-r--r--src/lua_api.c6
1 files changed, 4 insertions, 2 deletions
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;