rgit CLI errors go to stderr, so a stdout-only test helper sees empty text
Symptom#
A manual run of rgit add build/x exits with 1 and prints an error message. A test that reads the helper's out.stdout gets an empty text, so assertions on the message fail or pass for the wrong reason.
Cause#
rgit writes error messages such as error: pathspec contains ignored file 'build/x' to stderr. The test helper captures only stdout.
Fix#
Check which stream carries the message before you write the assertion. Run the command twice, once with 2>/dev/null and once with 2>&1 >/dev/null. In tests, read stderr, or make the helper capture both streams, when you assert on an error message.
Evidence#
Repro in a temp repo with .gitignore holding build/ and !build/x, run with RGIT_OUTPUT=human. Stdout was empty and stderr held error: pathspec contains ignored file 'build/x'. The agent noted: the helper captures only stdout (out.stdout).