mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
Shell: Disable interactive mode on '-c'
This also disables the full suite of interactive stuff in LibLine.
This commit is contained in:
parent
3fccf2481c
commit
4311c2164e
Notes:
sideshowbarker
2024-07-17 03:22:45 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/4311c2164e Pull-request: https://github.com/SerenityOS/serenity/pull/16444 Reviewed-by: https://github.com/kleinesfilmroellchen ✅
1 changed files with 10 additions and 2 deletions
|
@ -47,7 +47,15 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
bool attempt_interactive = false;
|
||||
|
||||
auto initialize = [&] {
|
||||
editor = Line::Editor::construct();
|
||||
auto configuration = Line::Configuration::from_config();
|
||||
if (!attempt_interactive) {
|
||||
configuration.set(Line::Configuration::Flags::None);
|
||||
configuration.set(Line::Configuration::SignalHandler::NoSignalHandlers);
|
||||
configuration.set(Line::Configuration::OperationMode::NonInteractive);
|
||||
configuration.set(Line::Configuration::RefreshBehavior::Eager);
|
||||
}
|
||||
|
||||
editor = Line::Editor::construct(move(configuration));
|
||||
editor->initialize();
|
||||
|
||||
shell = Shell::Shell::construct(*editor, attempt_interactive);
|
||||
|
@ -199,7 +207,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
|
||||
auto execute_file = !file_to_read_from.is_empty() && "-"sv != file_to_read_from;
|
||||
attempt_interactive = !execute_file;
|
||||
attempt_interactive = !execute_file && (command_to_run.is_empty() || keep_open);
|
||||
|
||||
if (keep_open && command_to_run.is_empty() && !execute_file) {
|
||||
warnln("Option --keep-open can only be used in combination with -c or when specifying a file to execute.");
|
||||
|
|
Loading…
Reference in a new issue