Repository navigation
Description
Summary
A missing input file or zero rows on the command line produces a Python traceback. A valid two-column render succeeds.
Motivation
Give a short error naming the bad value or missing file, with a useful nonzero exit status.
From the tagged libvt checkout, install the locked development dependencies with uv sync --frozen --python 3.14 --all-groups --all-extras. Use the checkout root as the working directory.
Save the following as case.py at the checkout root and run uv run --no-sync python case.py.
import subprocess
import sys
from pathlib import Path
from tempfile import TemporaryDirectory
def run(*args):
return subprocess.run([sys.executable, "-m", "libvt", *args], input=b"OK",
capture_output=True, check=False)
assert run("render", "--rows", "1", "--cols", "2").stdout.strip() == b"OK"
with TemporaryDirectory() as directory:
cases = [("geometry", run("render", "--rows", "0")), ("file", run("strip", str(Path(directory)/"absent.vt")))]
for name, result in cases:
print(name, "exit", result.returncode, "traceback", b"Traceback" in result.stderr)
assert all(r.returncode != 0 and b"Traceback" not in r.stderr for _, r in cases)Evidence
CPython 3.14.6 on Linux ARM64 under WSL2. The example produced the reported result against both v0.0.1a4 and the tested trunk revision.
Observed output
geometry exit 1 traceback True
file exit 1 traceback True
Proposal
Validate positive CLI dimensions and handle file errors at the command boundary. Test stdout, stderr and exit status for each subcommand.
- Developer experience — A shell-based terminal QA job can distinguish a bad invocation from a broken renderer.
- Immediate benefit — An incorrect size or filename can be fixed from one line of output.
- Longer-term benefit — The CLI can keep a stable contract for scripts while the library exposes detailed exceptions.
- End-user experience — A first-time user can correct the command without reading a stack trace.
Activity
tony commentedon Dec 3, 2026
rendernow validates geometry before opening its input. The CLI tests check exit status 2 for invalid rows or columns and unreadable input through each subcommand, plus a successful two-column render. PR #188