From 3652bcf731fcbe9439c43aac25f5c2cc16575f6a Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Sat, 24 Oct 2020 17:59:11 -0500 Subject: [PATCH] fixup! Fix assertion failure on job redirection error --- src/exec.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/exec.cpp b/src/exec.cpp index d9d5f0e5a..0437fb1b8 100644 --- a/src/exec.cpp +++ b/src/exec.cpp @@ -1049,7 +1049,7 @@ bool exec_job(parser_t &parser, const shared_ptr &j, const io_chain_t &bl // If exec_error then a backgrounded job would have been terminated before it was ever assigned // a pgroup, so error out before setting last_pid. auto pgid = j->get_pgid(); - if (j->is_foreground() && pgid.has_value()) { + if (!j->is_foreground() && pgid.has_value()) { parser.vars().set_one(L"last_pid", ENV_GLOBAL, to_string(*pgid)); }