From be395aab9a123a88058e73871fc30899763b5e29 Mon Sep 17 00:00:00 2001 From: AnotherTest Date: Wed, 12 Aug 2020 06:29:21 +0430 Subject: [PATCH] Shell: Do not assume that the job has exited after unblock in fg --- Shell/Builtin.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Shell/Builtin.cpp b/Shell/Builtin.cpp index e23588dbf0..cc5658ebdd 100644 --- a/Shell/Builtin.cpp +++ b/Shell/Builtin.cpp @@ -359,7 +359,10 @@ int Shell::builtin_fg(int argc, const char** argv) block_on_job(job); - return job->exit_code(); + if (job->exited()) + return job->exit_code(); + else + return 0; } int Shell::builtin_disown(int argc, const char** argv)