jobs: catching ChildProcessError (#5365)

* Update jobs.py

* Create jobs_catch_no_process.rst

* Update jobs.py

* Update jobs_catch_no_process.rst

* Update jobs.py
This commit is contained in:
Andy Kipp 2024-04-26 10:34:31 +02:00 committed by GitHub
parent 8ab1b9a0ee
commit 61751c2319
Failed to generate hash of commit
2 changed files with 26 additions and 0 deletions

View file

@ -0,0 +1,23 @@
**Added:**
* Added catching ChildProcessError in jobs. Avoiding hanging aliases in some cases.
**Changed:**
* <news item>
**Deprecated:**
* <news item>
**Removed:**
* <news item>
**Fixed:**
* <news item>
**Security:**
* <news item>

View file

@ -267,6 +267,9 @@ else:
obj = active_task["obj"]
backgrounded = False
try:
if obj.pid is None:
# When the process stopped before os.waitpid it has no pid.
raise ChildProcessError("The process PID not found.")
_, wcode = os.waitpid(obj.pid, os.WUNTRACED)
except ChildProcessError as e: # No child processes
if return_error: