https://github.com/pumpkinseed/cage
Simple library to catch stdout/stderr in Go
https://github.com/pumpkinseed/cage
golang-library stdout testing testing-tool
Last synced: 11 months ago
JSON representation
Simple library to catch stdout/stderr in Go
- Host: GitHub
- URL: https://github.com/pumpkinseed/cage
- Owner: PumpkinSeed
- License: apache-2.0
- Created: 2019-11-04T10:40:03.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-11-04T12:57:38.000Z (over 6 years ago)
- Last Synced: 2025-04-01T22:01:52.527Z (11 months ago)
- Topics: golang-library, stdout, testing, testing-tool
- Language: Go
- Homepage:
- Size: 7.81 KB
- Stars: 16
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cage
Simple library to catch stdout/stderr in Go.
#### Usage
```go
package main
import (
"fmt"
"os"
"github.com/PumpkinSeed/cage"
)
func main() {
c := cage.Start()
fmt.Println("test")
fmt.Println("test2")
fmt.Fprintln(os.Stderr, "stderr error")
cage.Stop(c)
fmt.Println(c.Data)
// [test, test2, stderr error]
}
```