(stdout, stderr string, ignoreExist1 bool, err error)
| 520 | } |
| 521 | |
| 522 | func handleErrString(stdout, stderr string, ignoreExist1 bool, err error) (string, error) { |
| 523 | var exitError *exec.ExitError |
| 524 | if ignoreExist1 && errors.As(err, &exitError) { |
| 525 | if status, ok := exitError.Sys().(syscall.WaitStatus); ok { |
| 526 | if status.ExitStatus() == 1 { |
| 527 | return "", nil |
| 528 | } |
| 529 | } |
| 530 | } |
| 531 | outItem := stdout |
| 532 | errItem := stderr |
| 533 | if len(errItem) != 0 && len(outItem) != 0 { |
| 534 | return outItem, fmt.Errorf("stdout: %s; stderr: %s, err: %v", outItem, errItem, err) |
| 535 | } |
| 536 | if len(errItem) != 0 { |
| 537 | return outItem, fmt.Errorf("stderr: %s, err: %v", errItem, err) |
| 538 | } |
| 539 | if len(outItem) != 0 { |
| 540 | return outItem, fmt.Errorf("stdout: %s, err: %v", outItem, err) |
| 541 | } |
| 542 | return "", err |
| 543 | } |
no test coverage detected