mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-13 21:12:26 +00:00
js: Save REPL history when exiting interpreter with exit()
Previously, we only saved the REPL history when the interpreter was shutdown with a signal. This change ensures that we save the history when a user uses `exit()`.
This commit is contained in:
parent
8266e40b35
commit
76891ae45d
Notes:
sideshowbarker
2024-07-18 00:41:35 +09:00
Author: https://github.com/evansmal
Commit: 76891ae45d
Pull-request: https://github.com/SerenityOS/serenity/pull/17414
Reviewed-by: https://github.com/linusg ✅
1 changed files with 1 additions and 0 deletions
|
@ -421,6 +421,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReplObject::save_to_file)
|
|||
|
||||
JS_DEFINE_NATIVE_FUNCTION(ReplObject::exit_interpreter)
|
||||
{
|
||||
s_editor->save_history(s_history_path.to_deprecated_string());
|
||||
if (!vm.argument_count())
|
||||
exit(0);
|
||||
exit(TRY(vm.argument(0).to_number(vm)).as_double());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue