From ba2e7db7e85961826da6e58d897e9903c3348e29 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sat, 12 Jun 2021 10:19:58 -0700 Subject: [PATCH] Notice when `exit` has been run from within fish_prompt This allows `exit` to tell the reader to stop, when run inside fish_prompt. Fixes #8033. --- CHANGELOG.rst | 1 + src/reader.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 95b7a1bfb..5683b67ee 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -51,6 +51,7 @@ Interactive improvements - fish now tries to find a Unicode-aware locale for encoding (``LC_CTYPE``) if started without any locale information, improving the display of emoji and other non-ASCII text on misconfigured systems (:issue:`8031`). To allow a C locale, set the variable ``fish_allow_singlebyte_locale`` to 1. - The Web-based configuration and documentation now feature a dark mode if the browser requests it (:issue:`8043`). - Color variables can now also be given like ``--background red`` and ``-b red``, not just ``--background=red`` (:issue:`8053`). +- ``exit`` run within ``fish_prompt`` now exits properly (:issue:`8033`). New or improved bindings ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/reader.cpp b/src/reader.cpp index 8856a3bd7..dc88fe4b5 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -1313,6 +1313,10 @@ void reader_data_t::exec_prompt() { // may still be output on the line from the previous command (#2499) and we need our PROMPT_SP // hack to work. reader_write_title(L"", parser(), false); + + // Some prompt may have requested an exit (#8033). + this->exit_loop_requested |= parser().libdata().exit_current_script; + parser().libdata().exit_current_script = false; } void reader_init() {