Fix bg command behaviour (#4810)

This commit is contained in:
Peter Ye 2022-05-19 23:15:03 -04:00 committed by GitHub
parent 572ebb576d
commit 57f1e4bcbd
Failed to generate hash of commit
2 changed files with 27 additions and 2 deletions

23
news/fix-broken-bg.rst Normal file
View file

@ -0,0 +1,23 @@
**Added:**
* <news item>
**Changed:**
* <news item>
**Deprecated:**
* <news item>
**Removed:**
* <news item>
**Fixed:**
* `bg` now properly resumes jobs in the background
**Security:**
* <news item>

View file

@ -383,7 +383,7 @@ def jobs(args, stdin=None, stdout=sys.stdout, stderr=None):
return None, None
def resume_job(args, wording):
def resume_job(args, wording: tp.Literal["fg", "bg"]):
"""
used by fg and bg to resume a job either in the foreground or in the background.
"""
@ -419,7 +419,9 @@ def resume_job(args, wording):
if XSH.env.get("XONSH_INTERACTIVE"):
print_one_job(tid)
pipeline = job["pipeline"]
pipeline.resume(job)
pipeline.resume(
job, tee_output=(wording == "fg")
) # do not tee output for background jobs
@unthreadable