commit 69890b8d5cf28a987c35455ec9747978b25c2d14
parent 96d38c410c7242de02a20243892e9d7fc8038f9f
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date: Wed, 6 Jan 2021 16:55:59 -0800
Fix bug in execute
If on the first command in a pipeline didn't exist it would pass
through to runpipes().
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/main.c b/main.c
@@ -338,10 +338,11 @@ execute(char const *cache, char *input, int depth, char **addr)
return ERROR;
}
cmds[i].f = getcom(cmds[i].argv[0], binds, LEN(binds));
- if (cmds[i].f != NULL) {
- return cmds[i].f(cmds[i].argc, cmds[i].argv,
- depth, addr);
+ if (cmds[i].f == NULL) {
+ warn(0, "'%s': Not a command.", cmds[i].argv[0]);
+ return ERROR;
}
+ return cmds[i].f(cmds[i].argc, cmds[i].argv, depth, addr);
}
}