From 1215717d20c9ef5654a0953a9ebe67a6e5f5459f Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Wed, 16 Sep 2020 17:44:43 +0200 Subject: [PATCH] Set exit status with delete-or-exit (regression from d415350aaf050104d1a8c1d4f4b1179f202aa105) This is important especially in e.g. the new Windows Terminal, because for some reason that lets the tab stick around if the process exited with a non-zero status. Will add tests as soon as I figure out how. --- src/reader.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/reader.cpp b/src/reader.cpp index ce7465e7f..d495cdc6b 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -2993,6 +2993,8 @@ void reader_data_t::handle_readline_command(readline_cmd_t c, readline_loop_stat if (el->position() < el->size()) { delete_char(false /* backward */); } else if (c == rl::delete_or_exit && el->empty()) { + // This is by definition a successful exit, override the status + parser().set_last_statuses(statuses_t::just(STATUS_CMD_OK)); exit_loop_requested = true; check_exit_loop_maybe_warning(this); }