fix: don't invoke if no args
This commit is contained in:
parent
3d318439d8
commit
4f09deb394
2 changed files with 5 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue