Skip to content
xz-devPublic

About

Cross-platform process-tree ownership and job control for CLI programs, built in Rust for pi and standalone use.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

203 Commits

Folders and files

Repository files navigation

procward

Procward owns a command's process tree and provides job control for CLI programs on Linux, FreeBSD, macOS and Windows. By default, it cleans up owned work when the command exits or its owner disappears, while preserving the command's exit status. macOS cleanup is best-effort for observed descendants, not kernel containment.

Installation

From crates.io or Git

Building from source requires Rust 1.88 or newer. Install the latest published version from crates.io:

cargo install --locked procward

Or build a tagged release directly from the Git repository:

cargo install --locked --git https://github.com/xz-dev/procward.git --tag v0.4.1 procward

Prebuilt binaries

Download your target's procward-<target>.zip and SHA256SUMS from Releases. Debug builds are named procward-<target>-debug.zip. Verify before extracting or running:

# Substitute the published version and your target.
tag=v0.3.0
target=x86_64-unknown-linux-gnu
asset="procward-$target.zip"
gh release download "$tag" --repo xz-dev/procward --pattern "$asset" --pattern SHA256SUMS
grep "  $asset$" SHA256SUMS | sha256sum --check -
gh attestation verify "$asset" --repo xz-dev/procward \
  --signer-workflow xz-dev/procward/.github/workflows/release.yml \
  --source-ref "refs/tags/$tag"
unzip "$asset"

Use shasum -a 256 on macOS or Get-FileHash -Algorithm SHA256 in PowerShell when sha256sum is unavailable. Put procward (procward.exe on Windows) on PATH. Full target list and source-pinned verification commands: CI and releases.

Agent skills

Install both guides globally for your coding agent:

npx skills add xz-dev/procward -g --skill procward --skill procward-dev
  • procward: run commands under procward, choose common flags, and understand platform limits.
  • procward-dev: integrate procward into an application, with Pi as an example, or develop and test procward itself.

To install just one guide, keep only its --skill selector. This installs instructions, not the executable. If procward --version is unavailable, install the binary using one of the methods above.

Usage

procward run -- command arg1 "two words"
procward run --grace 6s --fatal-grace 3s --cleanup-deadline 7500ms -- command

Arguments execute directly, without an added shell. Durations use integer s or ms; require 0 < fatal-grace <= grace < cleanup-deadline. Defaults are 6s, 3s and 7500ms. Use procward --help for options.

Routine diagnostics, such as the Linux cgroup fallback notice, are silent by default. Set PROCWARD_DEBUG=1 to see them on stderr. --quiet suppresses nonfatal cleanup warnings, even with debug enabled. Neither setting changes command output, fatal errors or cleanup behavior.

Task controllers can add --retain-descendants to receive the primary result while ordinary background work continues under ownership. The tree ends on natural completion, cancellation or owner/controller loss. This option requires --control-fd (Unix descriptor or Windows CRT descriptor) or --control-handle (Windows raw HANDLE); it does not detach or redirect the command. Windows controllers using ordinary extra inherited stdio, such as Node's stdio[3], use --control-fd 3, not --control-handle 3. See the task contract.

Development

Run Linux integration tests only in the disposable full-system VM: python3 ci/vm-test.py --kernel <installed-kernel> and the separate --hazard run. Host Cargo execution is guarded; containers and qemu-user alone are not isolation. See development for prerequisites, static checks, result records and the remote CI verification gate. Remote Linux jobs use copy-only full-system VM Actions, not host containers.

Background

Procward originated from the process-ownership needs of pi, its main intended consumer. This is a new standalone Rust implementation built on maintained crates and native OS facilities, not copied or translated pi or pi-env code.

Licensed under BSD-3-Clause.

About

Cross-platform process-tree ownership and job control for CLI programs, built in Rust for pi and standalone use.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages