https123456789 / bensh

A shell written with my common use cases in mind.
MIT License
0 stars 0 forks source link

[BUG] Killing children results in zombie/defunct processes. #2

Open https123456789 opened 1 year ago

https123456789 commented 1 year ago

When a process is killed via a SIGINT signal (sleep for example), the process is stopped and a new prompt shows, but the process enters a zombie like state. Running ps will show that the process is marked as <defunct>. Exiting the shell results in the zombie being fully killed.

Reproducing

  1. Start the shell
  2. Run the sleep command for 10 seconds (sleep 10)

    Note: This can be any amount of time

  3. Press ^C to send a SIGINT signal to the sleep command.
  4. Run the ps command ps
  5. The output will look like this:
    $ ./bin/Debug/bensh
    ┌─────────────────────┐
    │ BenSH - Ben's Shell │
    └─────────────────────┘
    Run exit to quit.
    [DEBUG] CWD: /home/runner/bensh
    >> sleep 10
    ^C
    >> ps
    PID TTY          TIME CMD
    128 pts/1    00:00:00 bash
    132 pts/1    00:00:00 bensh
    133 pts/1    00:00:00 sleep <defunct>
    134 pts/1    00:00:00 ps
    >> exit
    $ ps
    PID TTY          TIME CMD
    128 pts/1    00:00:00 bash
    135 pts/1    00:00:00 ps
    $
https123456789 commented 1 year ago

DEVEN!!!!

https123456789 commented 1 year ago

Resolved in this commit.

https123456789 commented 1 year ago

Nevermind