mirror of
https://github.com/go-gitea/gitea.git
synced 2026-01-21 12:20:48 +00:00
Refactor git command stderr handling (#36402)
And clean up legacy fragile & incorrect logic
This commit is contained in:
@@ -4,22 +4,9 @@
|
||||
package gitcmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
)
|
||||
|
||||
// ConcatenateError concatenates an error with stderr string
|
||||
// FIXME: use RunStdError instead
|
||||
func ConcatenateError(err error, stderr string) error {
|
||||
if len(stderr) == 0 {
|
||||
return err
|
||||
}
|
||||
errMsg := fmt.Sprintf("%s - %s", err.Error(), stderr)
|
||||
return util.ErrorWrap(&runStdError{err: err, stderr: stderr, errMsg: errMsg}, "%s", errMsg)
|
||||
}
|
||||
|
||||
func safeClosePtrCloser[T *io.ReadCloser | *io.WriteCloser](c T) {
|
||||
switch v := any(c).(type) {
|
||||
case *io.ReadCloser:
|
||||
|
||||
Reference in New Issue
Block a user