Skip to content

Commit 55f399c

Browse files
authored
Merge pull request #19120 from in0rdr/feat/document-stderr-redirect
Document stderr redirection for shell_output tests
2 parents fd0c851 + 8fa2119 commit 55f399c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

docs/Formula-Cookbook.md

+8
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,14 @@ test do
334334
end
335335
```
336336

337+
* If the binary only writes to `stderr`, you can redirect `stderr` to `stdout` for assertions with `shell_output`. For example:
338+
339+
```ruby
340+
test do
341+
assert_match "Output on stderr", shell_output("#{bin}/formula-program 2>&1", 2)
342+
end
343+
```
344+
337345
### Manuals
338346

339347
Homebrew expects to find manual pages in `#{prefix}/share/man/...`, and not in `#{prefix}/man/...`.

0 commit comments

Comments
 (0)