doc(cookbook): add specific case shell_output stderr

Document the specific case, where your program writes an error to stderr
that needs to be checked in a test (e.g., using `assert_match` and
`shell_output`):
* https://github.com/Homebrew/brew/issues/5149

Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
Andreas Gruhler 2025-01-19 13:59:24 +01:00
parent d40eb43333
commit 8fa2119719

View File

@ -334,6 +334,14 @@ test do
end
```
* If the binary only writes to `stderr`, you can redirect `stderr` to `stdout` for assertions with `shell_output`. For example:
```ruby
test do
assert_match "Output on stderr", shell_output("#{bin}/formula-program 2>&1", 2)
end
```
### Manuals
Homebrew expects to find manual pages in `#{prefix}/share/man/...`, and not in `#{prefix}/man/...`.