From 60ced5dbc70a2269ece22ce9d100ddeadc166dbb Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Sun, 30 Dec 2018 22:32:07 +0100 Subject: [PATCH] Only warn on exec for background jobs If it's a foreground job, it is related to the currently running exec. This fixes exec in functions, i.e. function reload exec fish end would previously always ask about the "function reload" job. Fixes #5449. Fixes oh-my-fish/oh-my-fish#664. --- src/parse_execution.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/parse_execution.cpp b/src/parse_execution.cpp index 701d41106..09b7f7d9d 100644 --- a/src/parse_execution.cpp +++ b/src/parse_execution.cpp @@ -773,7 +773,10 @@ parse_execution_result_t parse_execution_context_t::populate_plain_process( bool have_bg = false; const job_t *bg = nullptr; while ((bg = jobs.next())) { - if (!bg->is_completed()) { + // The assumption here is that if it is a foreground job, + // it's related to us. + // This stops us from asking if we're doing `exec` inside a function. + if (!bg->is_completed() && !bg->is_foreground()) { have_bg = true; break; }