Feat: add --strip-args-values-on-exit-error (#887)

* Add --strip-args-values-on-exit-error

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
Jan-Otto Kröpke
2023-06-07 14:39:38 +08:00
committed by GitHub
parent 8249833d14
commit f7b9de6ac1
10 changed files with 141 additions and 60 deletions
+4 -1
View File
@@ -5,13 +5,16 @@ import (
"strings"
)
func newExitError(path string, args []string, exitStatus int, err error, stderr, combined string) ExitError {
func newExitError(path string, args []string, exitStatus int, err error, stderr, combined string, stripArgsValuesOnExitError bool) ExitError {
var out string
out += fmt.Sprintf("PATH:\n%s", Indent(path, " "))
out += "\n\nARGS:"
for i, a := range args {
if i > 0 && strings.HasPrefix(args[i-1], "--set") && stripArgsValuesOnExitError {
a = "*** STRIP ***"
}
out += fmt.Sprintf("\n%s", Indent(fmt.Sprintf("%d: %s (%d bytes)", i, a, len(a)), " "))
}