summaryrefslogtreecommitdiff
path: root/Userland/Shell
diff options
context:
space:
mode:
authorTim Schumacher <timschumi@gmx.de>2023-03-23 02:37:09 +0100
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2023-03-29 03:39:09 +0330
commitb1739029ef614dba2cb3ca5952b876d084acd7ea (patch)
treef80efd4ad7550ae22fbda2e1de129262fc2e5d38 /Userland/Shell
parent0a63e543b7ac1b899648b51409cc21e7ae66b194 (diff)
downloadserenity-b1739029ef614dba2cb3ca5952b876d084acd7ea.zip
Shell: Evaluate the program name before parsing arguments
Otherwise, we are too late to catch the "load the POSIX-compatible shellrc" branch.
Diffstat (limited to 'Userland/Shell')
-rw-r--r--Userland/Shell/main.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Shell/main.cpp b/Userland/Shell/main.cpp
index e01212bef4..77101d49f9 100644
--- a/Userland/Shell/main.cpp
+++ b/Userland/Shell/main.cpp
@@ -60,7 +60,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
editor = Line::Editor::construct(move(configuration));
editor->initialize();
- shell = Shell::Shell::construct(*editor, attempt_interactive, posix_mode || LexicalPath::basename(arguments.strings[0]) == "sh"sv);
+ shell = Shell::Shell::construct(*editor, attempt_interactive, posix_mode);
s_shell = shell.ptr();
s_shell->setup_signals();
@@ -171,7 +171,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
StringView format;
bool should_format_live = false;
bool keep_open = false;
- bool posix_mode = false;
+ bool posix_mode = (LexicalPath::basename(arguments.strings[0]) == "sh"sv);
Core::ArgsParser parser;
parser.add_option(command_to_run, "String to read commands from", "command-string", 'c', "command-string");