From 4f09deb394881c322c27f716c7d5cc18fe6d262f Mon Sep 17 00:00:00 2001 From: Ahurac Date: Thu, 7 Nov 2024 15:34:52 +0100 Subject: [PATCH] fix: don't invoke if no args --- src/command.c | 2 +- src/main.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/command.c b/src/command.c index f3e3c06..400f5fe 100644 --- a/src/command.c +++ b/src/command.c @@ -5,7 +5,7 @@ unsigned char invoke(struct Args args) { pid_t child = fork(); - if (child == 0 && args.argc > 0) { + if (child == 0) { execvp(args.argv[0], args.argv); return 1; } diff --git a/src/main.c b/src/main.c index 8901653..5e073d1 100644 --- a/src/main.c +++ b/src/main.c @@ -18,7 +18,10 @@ int main() { struct Args args = parse(input_line); free(input_line); - invoke(args); + if (args.argc > 0) { + invoke(args); + } + { unsigned int i = 0; while (i < args.argc) {