diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-07-25 07:03:29 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-07-25 07:05:38 +0200 |
commit | 7c3b2e0728b79ddba661cbf1ac61f5da382460ce (patch) | |
tree | 873d69da53f5540ce24a91bf6d142264fc7a3c69 | |
parent | f186c018f14afb008f404c0c26bfd151261d595b (diff) | |
download | serenity-7c3b2e0728b79ddba661cbf1ac61f5da382460ce.zip |
Shell: Simply print "cmd: Command not found." for ENOENT on execution.
This looks a little nicer than 'execvp(cmd): No such file or directory'
-rw-r--r-- | Shell/main.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Shell/main.cpp b/Shell/main.cpp index c6aa1e0270..056bcbdf5f 100644 --- a/Shell/main.cpp +++ b/Shell/main.cpp @@ -463,7 +463,10 @@ static int run_command(const String& cmd) int rc = execvp(argv[0], const_cast<char* const*>(argv.data())); if (rc < 0) { - fprintf(stderr, "execvp(%s): %s\n", argv[0], strerror(errno)); + if (errno == ENOENT) + fprintf(stderr, "%s: Command not found.\n", argv[0]); + else + fprintf(stderr, "execvp(%s): %s\n", argv[0], strerror(errno)); exit(1); } ASSERT_NOT_REACHED(); |