Shell: Simply print "cmd: Command not found." for ENOENT on execution.
This looks a little nicer than 'execvp(cmd): No such file or directory'
This commit is contained in:
parent
f186c018f1
commit
7c3b2e0728
Notes:
sideshowbarker
2024-07-19 13:04:11 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/7c3b2e0728b
1 changed files with 4 additions and 1 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue