diff options
author | Andreas Kling <awesomekling@gmail.com> | 2018-11-02 14:06:48 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2018-11-02 14:06:48 +0100 |
commit | 10b666f69a610c0bdc5bd60efd1d7d2bf499707d (patch) | |
tree | 3c552bce003cd7b9a95f161fa12b7d73f902c088 /Userland/sh.cpp | |
parent | 621217ffeb9bddec866ad8895bd01973977f2848 (diff) | |
download | serenity-10b666f69a610c0bdc5bd60efd1d7d2bf499707d.zip |
Basic ^C interrupt implementation.
For testing, I made cat put itself into a new process group.
This should eventually be done by sh between fork() and exec().
Diffstat (limited to 'Userland/sh.cpp')
-rw-r--r-- | Userland/sh.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Userland/sh.cpp b/Userland/sh.cpp index c5669449c5..524658e27f 100644 --- a/Userland/sh.cpp +++ b/Userland/sh.cpp @@ -157,7 +157,14 @@ static int runcmd(char* cmd) //printf("Exited normally with status %d\n", WEXITSTATUS(wstatus)); } else { if (WIFSIGNALED(wstatus)) { - printf("Terminated by signal %d\n", WTERMSIG(wstatus)); + switch (WTERMSIG(wstatus)) { + case SIGINT: + printf("Interrupted\n"); + break; + default: + printf("Terminated by signal %d\n", WTERMSIG(wstatus)); + break; + } } else { printf("Exited abnormally\n"); } |