Skip to content

Commit dfcc970

Browse files
committed
better handling of ansi chars
1 parent 5d1a326 commit dfcc970

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

runner/runner.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1183,7 +1183,7 @@ func (r *Runner) RunEnumeration() {
11831183

11841184
//nolint:errcheck // this method needs a small refactor to reduce complexity
11851185
if plainFile != nil {
1186-
plainFile.WriteString(stripANSI(resp.str) + "\n")
1186+
plainFile.WriteString(handleStripAnsiCharacters(resp.str, r.options.NoColor) + "\n")
11871187
}
11881188

11891189
if len(r.options.ExcludeOutputFields) > 0 {
@@ -1348,6 +1348,13 @@ func (r *Runner) RunEnumeration() {
13481348
}
13491349
}
13501350

1351+
func handleStripAnsiCharacters(data string, skip bool) string {
1352+
if skip {
1353+
return data
1354+
}
1355+
return stripANSI(data)
1356+
}
1357+
13511358
func logFilteredErrorPage(fileName, url string) {
13521359
dir := filepath.Dir(fileName)
13531360
if !fileutil.FolderExists(dir) {

0 commit comments

Comments
 (0)