Skip to content

Commit

Permalink
Revert jobs.obj rename (#5442)
Browse files Browse the repository at this point in the history
### Motivation

Closes #5441

In the nutshell [Starship uses
"obj"](https://github.com/starship/starship/blob/86c1312a05116fb404ab6ae90af37f78915f77b8/src/init/starship.xsh#L4-L11)
so let's revert [the
renaming](0f25a5a#diff-893f3d2e484910a3d1f57b499bdc81bf828ad764af9b7de0a8abb3d4e648d2c7L958)
and will implement backwards compatibility when we switch jobs to
singleton object some day.

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

Co-authored-by: a <1@1.1>
  • Loading branch information
anki-code and a committed May 25, 2024
1 parent f582a33 commit 1613914
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions xonsh/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def _continue(job):

def _kill(job):
subprocess.check_output(
["taskkill", "/F", "/T", "/PID", str(job["proc"].pid)],
["taskkill", "/F", "/T", "/PID", str(job["obj"].pid)],
stderr=subprocess.STDOUT,
)

Expand All @@ -231,7 +231,7 @@ def wait_for_active_job(last_task=None, backgrounded=False, return_error=False):
# Return when there are no foreground active task
if active_task is None:
return last_task
proc = active_task["proc"]
proc = active_task["obj"]
_continue(active_task)
while proc.returncode is None:
try:
Expand Down Expand Up @@ -344,7 +344,7 @@ def wait_for_active_job(last_task=None, backgrounded=False, return_error=False):
# Return when there are no foreground active task
if active_task is None:
return last_task
proc = active_task["proc"]
proc = active_task["obj"]
info = {"backgrounded": False}

try:
Expand Down Expand Up @@ -402,7 +402,7 @@ def _clear_dead_jobs():
to_remove = set()
tasks = get_tasks()
for tid in tasks:
proc = get_task(tid)["proc"]
proc = get_task(tid)["obj"]
if proc is None or proc.poll() is not None:
to_remove.add(tid)
for job in to_remove:
Expand Down
2 changes: 1 addition & 1 deletion xonsh/procs/specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ def _run_command_pipeline(specs, cmds):
"cmds": cmds,
"pids": [i.pid for i in cp.procs],
"status": "suspended" if cp.suspended else "running",
"proc": proc,
"obj": proc,
"bg": background,
"pipeline": cp,
"pgrp": cp.term_pgid,
Expand Down

0 comments on commit 1613914

Please sign in to comment.