summaryrefslogtreecommitdiff
path: root/Shell/Builtin.cpp
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2021-01-03 12:38:20 +0330
committerAndreas Kling <kling@serenityos.org>2021-01-03 17:13:00 +0100
commita698af88fcede7ba4db04fe4f9a98991c545ea7d (patch)
treeb197349386a6771b5ebe83dd53453060f17be4b2 /Shell/Builtin.cpp
parent3d51bcaa4ed551132fd676e53323b3999f9506c1 (diff)
downloadserenity-a698af88fcede7ba4db04fe4f9a98991c545ea7d.zip
Shell: Show a snippet of what caused the error (if possible)
Now we can have nice errors too: ``` Shell: Glob did not match anything! 0| echo ?x ~~~~~~~~~~^^ 1| ```
Diffstat (limited to 'Shell/Builtin.cpp')
-rw-r--r--Shell/Builtin.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/Shell/Builtin.cpp b/Shell/Builtin.cpp
index 3a7e6c884a..99727f524a 100644
--- a/Shell/Builtin.cpp
+++ b/Shell/Builtin.cpp
@@ -866,10 +866,12 @@ bool Shell::run_builtin(const AST::Command& command, const NonnullRefPtrVector<A
Core::EventLoop loop;
setup_signals();
-#define __ENUMERATE_SHELL_BUILTIN(builtin) \
- if (name == #builtin) { \
- retval = builtin_##builtin(argv.size() - 1, argv.data()); \
- return true; \
+#define __ENUMERATE_SHELL_BUILTIN(builtin) \
+ if (name == #builtin) { \
+ retval = builtin_##builtin(argv.size() - 1, argv.data()); \
+ if (!has_error(ShellError::None)) \
+ raise_error(m_error, m_error_description, command.position); \
+ return true; \
}
ENUMERATE_SHELL_BUILTINS();