Skip to content
Back to top
View this page
Edit this page

# xonsh.procs.jobs

Job control for the xonsh shell.

xonsh.procs.jobs.add_job(info)

  Add a new job to the jobs dictionary.

xonsh.procs.jobs.bg(args, stdin=None)

  xonsh command: bg

  Resume execution of the currently active job in the background, or, if a single number is given as an argument, resume that job in the background.

xonsh.procs.jobs.clean_jobs()

  Clean up jobs for exiting shell

  In non-interactive mode, send SIGHUP to all jobs.

  In interactive mode, check for suspended or background jobs, print a warning if any exist, and return False. Otherwise, return True.

xonsh.procs.jobs.disown_fn(job_ids: ~typing.Annotated[~typing.Sequence[int], ((), (('type', <class 'int'>), ('nargs', '*'), ('completer', <function job_id_completer at 0x77972b898460>)))], force_auto_continue=False)

  Remove the specified jobs from the job table; the shell will no longer report their status, and will not complain if you try to exit an interactive shell with them running or stopped.

  If the jobs are currently stopped and the $AUTO_CONTINUE option is not set ($AUTO_CONTINUE = False), a warning is printed containing information about how to make them continue after they have been disowned.

  Parameters:
    job_ids

      Jobs to act on or none to disown the current job

    force_auto_continue-c, –continue

      Automatically continue stopped jobs when they are disowned, equivalent to setting $AUTO_CONTINUE=True

xonsh.procs.jobs.fg(args, stdin=None)

  xonsh command: fg

  Bring the currently active job to the foreground, or, if a single number is given as an argument, bring that job to the foreground. Additionally, specify “+” for the most recent job and “-” for the second most recent job.

xonsh.procs.jobs.format_job_string(num: int, format='dict') → str

xonsh.procs.jobs.get_jobs() → dict[int, dict]

xonsh.procs.jobs.get_next_job_number()

  Get the lowest available unique job number (for the next job created).

xonsh.procs.jobs.get_next_task()

  Get the next active task and put it on top of the queue

xonsh.procs.jobs.get_task(tid)

xonsh.procs.jobs.get_tasks() → deque[int]

xonsh.procs.jobs.give_terminal_to(pgid)

xonsh.procs.jobs.hup_all_jobs()

  Send SIGHUP to all child processes (called when exiting xonsh).

xonsh.procs.jobs.ignore_sigtstp()

xonsh.procs.jobs.job_id_completer(xsh, **_)

  Return currently running jobs ids

xonsh.procs.jobs.jobs(args, stdin=None, stdout=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, stderr=None)

  xonsh command: jobs

  Display a list of all current jobs.

xonsh.procs.jobs.print_one_job(num, outfile=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, format='dict')

  Print a line describing job number `num`.

xonsh.procs.jobs.proc_untraced_waitpid(proc, hang, task=None, raise_child_process_error=False)

  Read a stop signals from the process and update the process state.

xonsh.procs.jobs.resume_job(args, wording: Literal['fg', 'bg'])

  used by fg and bg to resume a job either in the foreground or in the background.

xonsh.procs.jobs.update_job_attr(pid, name, value)

  Update job attribute.

xonsh.procs.jobs.use_main_jobs()

  Context manager that replaces a thread’s task queue and job dictionary with those of the main thread

  This allows another thread (e.g. the commands jobs, disown, and bg) to handle the main thread’s job control.

xonsh.procs.jobs.wait_for_active_job(last_task=None, backgrounded=False, return_error=False)

  Wait for the active job to finish, to be killed by SIGINT, or to be suspended by ctrl-z.