From 76891ae45df15c411cba10b826ef11aa3608200c Mon Sep 17 00:00:00 2001 From: Evan Smal Date: Fri, 10 Feb 2023 11:02:52 -0500 Subject: [PATCH] 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()`. --- Userland/Utilities/js.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Userland/Utilities/js.cpp b/Userland/Utilities/js.cpp index b41979278c..fdeb39e5aa 100644 --- a/Userland/Utilities/js.cpp +++ b/Userland/Utilities/js.cpp @@ -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());