1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:27:44 +00:00

Shell: Minimally implement the 'set' builtin

This only implements the printing and argv setting behaviours.
This commit is contained in:
Ali Mohammad Pur 2023-10-13 03:10:31 +03:30 committed by Ali Mohammad Pur
parent 867f7da017
commit 5cb994d4dd
2 changed files with 90 additions and 19 deletions

View file

@ -38,6 +38,7 @@
__ENUMERATE_SHELL_BUILTIN(glob, InAllModes) \
__ENUMERATE_SHELL_BUILTIN(unalias, InAllModes) \
__ENUMERATE_SHELL_BUILTIN(unset, InAllModes) \
__ENUMERATE_SHELL_BUILTIN(set, InAllModes) \
__ENUMERATE_SHELL_BUILTIN(history, InAllModes) \
__ENUMERATE_SHELL_BUILTIN(umask, InAllModes) \
__ENUMERATE_SHELL_BUILTIN(not, InAllModes) \
@ -479,15 +480,17 @@ private:
// clang-format on
};
bool m_should_ignore_jobs_on_next_exit { false };
pid_t m_pid { 0 };
struct ShellFunction {
DeprecatedString name;
Vector<DeprecatedString> arguments;
RefPtr<AST::Node> body;
};
ErrorOr<String> serialize_function_definition(ShellFunction const&) const;
bool m_should_ignore_jobs_on_next_exit { false };
pid_t m_pid { 0 };
HashMap<DeprecatedString, ShellFunction> m_functions;
Vector<NonnullOwnPtr<LocalFrame>> m_local_frames;
Promise::List m_active_promises;