Step 7 - Challenge: Handling Signals

In this step your goal is to handle signals that would interrupt the shell. For example CTRL-C. When a user enters CTRL-C to quit a program we don’t want it to terminate the shell as well.

That said we do still want to be able to quit commands we’ve run in our shell with CTRL-C, so you will need to ensure the signal handler is restored for external commands.

Here’s what that looks like:

% ccsh
ccsh> ^C
ccsh> cat
^Cccsh> exit
ccsh %

In this example we can see that CTRL-C (rendered as ^C) does not terminate the shell, but does terminate the external command cat.