fix: don't invoke if no args

This commit is contained in:
Ahurac 2024-11-07 15:34:52 +01:00
parent 3d318439d8
commit 4f09deb394
2 changed files with 5 additions and 2 deletions

View file

@ -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;
}

View file

@ -18,7 +18,10 @@ int main() {
struct Args args = parse(input_line);
free(input_line);
if (args.argc > 0) {
invoke(args);
}
{
unsigned int i = 0;
while (i < args.argc) {