* Only write to global gitconfig if necessary Fix #11855 Signed-off-by: Andrew Thornton <art27@cantab.net> * placate lint Signed-off-by: Andrew Thornton <art27@cantab.net>
Showing the changes to modules/process (1 of 2 files). Show all
Unified · Split
| @@ -157,7 +157,14 @@ func (pm *Manager) ExecDirEnvStdIn(timeout time.Duration, dir, desc string, env · 156 unmodified lines | ||
| 157 | 157 | pm.Remove(pid) |
| 158 | 158 | |
| 159 | 159 | if err != nil { |
| 160 | − err = fmt.Errorf("exec(%d:%s) failed: %v(%v) stdout: %v stderr: %v", pid, desc, err, ctx.Err(), stdOut, stdErr) | |
| 160 | + err = &Error{ | |
| 161 | + PID: pid, | |
| 162 | + Description: desc, | |
| 163 | + Err: err, | |
| 164 | + CtxErr: ctx.Err(), | |
| 165 | + Stdout: stdOut.String(), | |
| 166 | + Stderr: stdErr.String(), | |
| 167 | + } | |
| 161 | 168 | } |
| 162 | 169 | |
| 163 | 170 | return stdOut.String(), stdErr.String(), err |
| @@ -176,3 +183,22 @@ func (l processList) Less(i, j int) bool { · 12 unmodified lines | ||
| 176 | 183 | func (l processList) Swap(i, j int) { |
| 177 | 184 | l[i], l[j] = l[j], l[i] |
| 178 | 185 | } |
| 186 | + | |
| 187 | +// Error is a wrapped error describing the error results of Process Execution | |
| 188 | +type Error struct { | |
| 189 | + PID int64 | |
| 190 | + Description string | |
| 191 | + Err error | |
| 192 | + CtxErr error | |
| 193 | + Stdout string | |
| 194 | + Stderr string | |
| 195 | +} | |
| 196 | + | |
| 197 | +func (err *Error) Error() string { | |
| 198 | + return fmt.Sprintf("exec(%d:%s) failed: %v(%v) stdout: %s stderr: %s", err.PID, err.Description, err.Err, err.CtxErr, err.Stdout, err.Stderr) | |
| 199 | +} | |
| 200 | + | |
| 201 | +// Unwrap implements the unwrappable implicit interface for go1.13 Unwrap() | |
| 202 | +func (err *Error) Unwrap() error { | |
| 203 | + return err.Err | |
| 204 | +} | |