diff options
author | Nick Vella <nick@nxk.io> | 2021-01-15 21:22:20 +1100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-01-16 09:05:01 +0100 |
commit | fdc9b3c5a0e52af330d8c5109ec7064535fbe478 (patch) | |
tree | 4259c9a6e06199cc15565598f40e4a8fa3070749 | |
parent | 1d11b62ca4f4f75a3d0e1a1459c20a74b0b78fa1 (diff) | |
download | serenity-fdc9b3c5a0e52af330d8c5109ec7064535fbe478.zip |
Shell: use exit code 127 on command not found
-rw-r--r-- | Userland/Shell/Shell.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Userland/Shell/Shell.cpp b/Userland/Shell/Shell.cpp index 2fb4c86b65..d63fc3c0a5 100644 --- a/Userland/Shell/Shell.cpp +++ b/Userland/Shell/Shell.cpp @@ -886,10 +886,12 @@ void Shell::execute_process(Vector<const char*>&& argv) struct stat st; if (stat(argv[0], &st)) { fprintf(stderr, "stat(%s): %s\n", argv[0], strerror(errno)); - _exit(126); + // Return code 127 on command not found. + _exit(127); } if (!(st.st_mode & S_IXUSR)) { fprintf(stderr, "%s: Not executable\n", argv[0]); + // Return code 126 when file is not executable. _exit(126); } if (saved_errno == ENOENT) { |