MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / waitPipeCommands

Function waitPipeCommands

core/utils/cmd/cmdx.go:262–280  ·  view source on GitHub ↗
(ctx context.Context, cmds []*exec.Cmd)

Source from the content-addressed store, hash-verified

260}
261
262func waitPipeCommands(ctx context.Context, cmds []*exec.Cmd) error {
263 done := make(chan error, 1)
264 go func() {
265 var runErr error
266 for _, item := range cmds {
267 if err := item.Wait(); err != nil && runErr == nil {
268 runErr = err
269 }
270 }
271 done <- runErr
272 }()
273 select {
274 case runErr := <-done:
275 return runErr
276 case <-ctx.Done():
277 killProcessGroups(cmds)
278 return <-done
279 }
280}
281
282func (c *CommandHelper) run(name string, arg ...string) (string, error) {
283 var cmd *exec.Cmd

Callers 2

RunPipeMethod · 0.70
RunPipeToFileMethod · 0.70

Calls 2

killProcessGroupsFunction · 0.70
WaitMethod · 0.45

Tested by

no test coverage detected