GenServer wrapping a background OS process.
Each background job is managed by a JobProcess GenServer which:
- Starts and monitors the OS process via CommandPort
- Accumulates stdout/stderr output preserving order
- Notifies the Session on status changes (done, stopped)
- Supports foregrounding (blocks caller until completion)
- Handles signals (SIGSTOP, SIGCONT, SIGTERM, etc.)
Lifecycle
- Started by Session via
start_link/1 - Spawns OS process via CommandPort
- Spawns reader tasks for stdout/stderr that send messages back
- On process exit, notifies Session and transitions to :done
- Can be foregrounded (caller blocks until done)
- Can receive signals (kill, stop, continue)
Summary
Types
@type t() :: %Bash.JobProcess{ await_start_from: term(), command_string: String.t(), env: [{String.t(), String.t()}], excmd_process: pid() | nil, foreground_from: GenServer.from() | nil, job: Bash.Job.t(), last_signal: term(), os_pid: pos_integer() | nil, output_collector: term(), session_pid: pid(), stderr_reader: pid() | nil, stderr_sink: term(), stdout_reader: pid() | nil, stdout_sink: term(), working_dir: String.t() }