summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2021-03-30 02:18:06 +0430
committerAndreas Kling <kling@serenityos.org>2021-03-31 23:49:26 +0200
commit50f5959996803eb8adb3d83d922f3df3bc91fa34 (patch)
tree8208842f9821d893e51ead655df356222a56c14e
parente3fd914187b318ed1fda9f806c5edda58622d578 (diff)
downloadserenity-50f5959996803eb8adb3d83d922f3df3bc91fa34.zip
Shell: Use existing job state when waitpid() returns 0 in `jobs`
-rw-r--r--Userland/Shell/Job.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/Userland/Shell/Job.cpp b/Userland/Shell/Job.cpp
index de662033fb..c66322fbd5 100644
--- a/Userland/Shell/Job.cpp
+++ b/Userland/Shell/Job.cpp
@@ -48,9 +48,10 @@ bool Job::print_status(PrintStatusMode mode)
if (WIFSIGNALED(wstatus))
status = "signaled";
- } else if (rc < 0) {
- // We couldn't waitpid() it, probably because we're not the parent shell.
- // just use the old information.
+ } else {
+ // if rc < 0, We couldn't waitpid() it, probably because we're not the parent shell.
+ // Otherwise, the information we have is already correct,
+ // so just use the old information.
if (exited())
status = "exited";
else if (m_is_suspended)