MCPcopy Index your code
hub / github.com/git-bug/git-bug / CloseBackend

Function CloseBackend

commands/execenv/loading.go:115–131  ·  view source on GitHub ↗

CloseBackend is a wrapper for a RunE function that will close the Backend properly if it has been opened. This wrapper style is necessary because a Cobra PostE function does not run if RunE return an error.

(env *Env, runE func(cmd *cobra.Command, args []string) error)

Source from the content-addressed store, hash-verified

113// if it has been opened.
114// This wrapper style is necessary because a Cobra PostE function does not run if RunE return an error.
115func CloseBackend(env *Env, runE func(cmd *cobra.Command, args []string) error) func(*cobra.Command, []string) error {
116 return func(cmd *cobra.Command, args []string) error {
117 errRun := runE(cmd, args)
118
119 if env.Backend == nil {
120 return nil
121 }
122 err := env.Backend.Close()
123 env.Backend = nil
124
125 // prioritize the RunE error
126 if errRun != nil {
127 return errRun
128 }
129 return err
130 }
131}
132
133func CacheBuildProgressBar(env *Env, events chan cache.BuildEvent) error {
134 var progress *mpb.Progress

Callers 15

newTermUICommandFunction · 0.92
newPushCommandFunction · 0.92
newLabelCommandFunction · 0.92
newPullCommandFunction · 0.92
NewBridgeCommandFunction · 0.92
newBridgePullCommandFunction · 0.92
newBridgePushCommandFunction · 0.92
newBridgeAuthCommandFunction · 0.92
newBridgeRmFunction · 0.92
newBridgeNewCommandFunction · 0.92
newBridgeAuthShowFunction · 0.92

Calls 1

CloseMethod · 0.65

Tested by

no test coverage detected