From 2610477836c32a7029f5485d5b376c29656d2293 Mon Sep 17 00:00:00 2001 From: AnotherTest Date: Tue, 27 Oct 2020 17:13:43 +0330 Subject: [PATCH] Shell: Only prompt the user for a second 'exit' when in interactive mode --- Shell/Builtin.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Shell/Builtin.cpp b/Shell/Builtin.cpp index 5194d6ace4..f9994965c6 100644 --- a/Shell/Builtin.cpp +++ b/Shell/Builtin.cpp @@ -262,11 +262,13 @@ int Shell::builtin_exit(int argc, const char** argv) if (!parser.parse(argc, const_cast(argv))) return 1; - if (!jobs.is_empty()) { - if (!m_should_ignore_jobs_on_next_exit) { - fprintf(stderr, "Shell: You have %zu active job%s, run 'exit' again to really exit.\n", jobs.size(), jobs.size() > 1 ? "s" : ""); - m_should_ignore_jobs_on_next_exit = true; - return 1; + if (m_is_interactive) { + if (!jobs.is_empty()) { + if (!m_should_ignore_jobs_on_next_exit) { + fprintf(stderr, "Shell: You have %zu active job%s, run 'exit' again to really exit.\n", jobs.size(), jobs.size() > 1 ? "s" : ""); + m_should_ignore_jobs_on_next_exit = true; + return 1; + } } } stop_all_jobs();