From 7c3b2e0728b79ddba661cbf1ac61f5da382460ce Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 25 Jul 2019 07:03:29 +0200 Subject: Shell: Simply print "cmd: Command not found." for ENOENT on execution. This looks a little nicer than 'execvp(cmd): No such file or directory' --- Shell/main.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Shell') 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(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(); -- cgit v1.2.3