Skip to content

Commit

Permalink
Shell: Only prompt the user for a second 'exit' when in interactive mode
Browse files Browse the repository at this point in the history
  • Loading branch information
alimpfard authored and awesomekling committed Oct 29, 2020
1 parent 71bb62d commit 2610477
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Shell/Builtin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,13 @@ int Shell::builtin_exit(int argc, const char** argv)
if (!parser.parse(argc, const_cast<char**>(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();
Expand Down

0 comments on commit 2610477

Please sign in to comment.