captureOutput() — fiber Function Reference
Architecture documentation for the captureOutput() function in listen_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD e606935d_5140_5f32_e530_9b041f7f3116["captureOutput()"] edd60c6a_f37d_c392_5301_d2d5a002990a["listen_test.go"] e606935d_5140_5f32_e530_9b041f7f3116 -->|defined in| edd60c6a_f37d_c392_5301_d2d5a002990a 2583b4ec_9c46_ed16_2cbf_7bf63f3e6cea["Test_Listen_Master_Process_Show_Startup_Message()"] 2583b4ec_9c46_ed16_2cbf_7bf63f3e6cea -->|calls| e606935d_5140_5f32_e530_9b041f7f3116 cae6d54b_ac1a_33cb_701d_706e7d02d060["Test_Listen_Master_Process_Show_Startup_MessageWithAppName()"] cae6d54b_ac1a_33cb_701d_706e7d02d060 -->|calls| e606935d_5140_5f32_e530_9b041f7f3116 0c15c05d_9e50_9fe1_9dfd_9126ba9cf255["Test_Listen_Master_Process_Show_Startup_MessageWithAppNameNonAscii()"] 0c15c05d_9e50_9fe1_9dfd_9126ba9cf255 -->|calls| e606935d_5140_5f32_e530_9b041f7f3116 f2f90094_e2d1_9a16_775d_2a6a61d09e1b["Test_Listen_Master_Process_Show_Startup_MessageWithDisabledPreforkAndCustomEndpoint()"] f2f90094_e2d1_9a16_775d_2a6a61d09e1b -->|calls| e606935d_5140_5f32_e530_9b041f7f3116 e07e8a9a_278d_a581_ee7a_f472bae20167["Test_StartupMessageCustomization()"] e07e8a9a_278d_a581_ee7a_f472bae20167 -->|calls| e606935d_5140_5f32_e530_9b041f7f3116 b8350d31_ef28_a3f8_bb89_ba09c8f47080["Test_StartupMessageDisabledPostHook()"] b8350d31_ef28_a3f8_bb89_ba09c8f47080 -->|calls| e606935d_5140_5f32_e530_9b041f7f3116 092684f5_87f2_33ed_d9cc_2092324f3507["Test_StartupMessagePreventedByHook()"] 092684f5_87f2_33ed_d9cc_2092324f3507 -->|calls| e606935d_5140_5f32_e530_9b041f7f3116 27615a06_d832_528b_799a_e7f27b9f62e1["Test_Listen_Print_Route()"] 27615a06_d832_528b_799a_e7f27b9f62e1 -->|calls| e606935d_5140_5f32_e530_9b041f7f3116 9e40732b_8b67_a197_c3f0_09419eed9623["Test_Listen_Print_Route_With_Group()"] 9e40732b_8b67_a197_c3f0_09419eed9623 -->|calls| e606935d_5140_5f32_e530_9b041f7f3116 style e606935d_5140_5f32_e530_9b041f7f3116 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
listen_test.go lines 869–899
func captureOutput(f func()) string {
reader, writer, err := os.Pipe()
if err != nil {
panic(err)
}
stdout := os.Stdout
stderr := os.Stderr
defer func() {
os.Stdout = stdout
os.Stderr = stderr
log.SetOutput(os.Stderr)
}()
os.Stdout = writer
os.Stderr = writer
log.SetOutput(writer)
out := make(chan string)
go func() {
var buf bytes.Buffer
_, copyErr := io.Copy(&buf, reader)
if copyErr != nil {
panic(copyErr)
}
out <- buf.String() // this out channel helps in synchronization
}()
f()
err = writer.Close()
if err != nil {
panic(err)
}
return <-out
}
Domain
Subdomains
Defined In
Called By
- Test_Listen_Master_Process_Show_Startup_Message()
- Test_Listen_Master_Process_Show_Startup_MessageWithAppName()
- Test_Listen_Master_Process_Show_Startup_MessageWithAppNameNonAscii()
- Test_Listen_Master_Process_Show_Startup_MessageWithDisabledPreforkAndCustomEndpoint()
- Test_Listen_Print_Route()
- Test_Listen_Print_Route_With_Group()
- Test_StartupMessageCustomization()
- Test_StartupMessageDisabledPostHook()
- Test_StartupMessagePreventedByHook()
Source
Frequently Asked Questions
What does captureOutput() do?
captureOutput() is a function in the fiber codebase, defined in listen_test.go.
Where is captureOutput() defined?
captureOutput() is defined in listen_test.go at line 869.
What calls captureOutput()?
captureOutput() is called by 9 function(s): Test_Listen_Master_Process_Show_Startup_Message, Test_Listen_Master_Process_Show_Startup_MessageWithAppName, Test_Listen_Master_Process_Show_Startup_MessageWithAppNameNonAscii, Test_Listen_Master_Process_Show_Startup_MessageWithDisabledPreforkAndCustomEndpoint, Test_Listen_Print_Route, Test_Listen_Print_Route_With_Group, Test_StartupMessageCustomization, Test_StartupMessageDisabledPostHook, and 1 more.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free