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

Function handleErrString

core/utils/cmd/cmdx.go:487–508  ·  view source on GitHub ↗
(stdout, stderr string, ignoreExist1 bool, err error)

Source from the content-addressed store, hash-verified

485}
486
487func handleErrString(stdout, stderr string, ignoreExist1 bool, err error) (string, error) {
488 var exitError *exec.ExitError
489 if ignoreExist1 && errors.As(err, &exitError) {
490 if status, ok := exitError.Sys().(syscall.WaitStatus); ok {
491 if status.ExitStatus() == 1 {
492 return "", nil
493 }
494 }
495 }
496 outItem := stdout
497 errItem := stderr
498 if len(errItem) != 0 && len(outItem) != 0 {
499 return outItem, fmt.Errorf("stdout: %s; stderr: %s, err: %v", outItem, errItem, err)
500 }
501 if len(errItem) != 0 {
502 return outItem, fmt.Errorf("stderr: %s, err: %v", errItem, err)
503 }
504 if len(outItem) != 0 {
505 return outItem, fmt.Errorf("stdout: %s, err: %v", outItem, err)
506 }
507 return "", err
508}

Callers 3

RunPipeMethod · 0.70
RunPipeToFileMethod · 0.70
handleErrFunction · 0.70

Calls 1

SysMethod · 0.80

Tested by

no test coverage detected