I'm having a few zombie processes that are running (defunct) in the background and I'm not quite sure how to kill them. I'm making a mini-shell, so it's basically like the terminal, but my own version of it.

Here is my code:

```
#include <stdio.h>
#include <string.h>
#include <stddef.h>
#include "main.h"

int main() {

    /* Declared variables */
    char buff[100];
    char* args[20];
    int arguments = 20;

    /* Boolean value */
    int done = 0;

    while(done != 1) {
        /* Print directory */
        printf("%s>", getcwd(0,0));
        /* Gets input */
        fgets(buff, 100, stdin);

        /* Checks to see if anything was entered */
        if (buff[0] == '\n') {
            printf("Error: Enter a command! (Example: ls -l)\n");
        } else {
            parseArgs(buff, args, 20, &arguments);

            if (*args[0] == '\n') {
                printf("Error: Enter a command! (Example: ls -l)\n");
            } else if (strcmp(args[0], "exit") == 0) {
                done = 1;
            } else if (strcmp(args[0], "cd") == 0) {
                /* Changes the directory */
                int dir = chdir(args[1]);
                if (dir != 0) {
                    printf("That directory isn't valid!\n");
                }
            } else {

                int background = 0;
                int count = 0;

                /* Create a new process */
                int process = fork();
                if (process == -1) {
                    printf("Error: Unable to create a process!");
                } else if (process == 0) {

                    /* Run user input */
                    int res = execvp(args[0], args);
                    if (res == -1) {
                        printf("\nError: Enter a command! (Example: ls -l)\n");
                        done = 1;
                    }

                    int reapingInfo;
                    waitpid(process, &reapingInfo, 0);
                }
            }
        }
    }
return (0);
}

```

Here is what I'm getting as an output when I run `ls -l` a few times and run the command: `ps`:

```
20978 pts /6        00:00:00 bash
21049 pts /6        00:00:00 main
21050 pts /6        00:00:00 ls <defunct>
21051 pts /6        00:00:00 ls <defunct>
21062 pts /6        00:00:00 ps

```

Any clues on how to reap these `defunct` processes?