Merge pull request #56 from sqshq/cleanup_escape_codes
Cleanup escape codes for regular and interactive shell sampling
This commit is contained in:
commit
423e50e3f2
|
@ -4,6 +4,7 @@ import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/lunixbochs/vtclean"
|
||||||
"io"
|
"io"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -118,7 +119,7 @@ func (s *BasicInteractiveShell) execute() (string, error) {
|
||||||
if errorText.Len() > 0 {
|
if errorText.Len() > 0 {
|
||||||
return "", errors.New(errorText.String())
|
return "", errors.New(errorText.String())
|
||||||
}
|
}
|
||||||
return s.item.transform(resultText.String())
|
return s.item.transform(vtclean.Clean(resultText.String(), false))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package data
|
||||||
|
|
||||||
import (
|
import (
|
||||||
ui "github.com/gizak/termui/v3"
|
ui "github.com/gizak/termui/v3"
|
||||||
|
"github.com/lunixbochs/vtclean"
|
||||||
"github.com/sqshq/sampler/config"
|
"github.com/sqshq/sampler/config"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
@ -70,7 +71,9 @@ func (i *Item) execute(variables []string, script string) (string, error) {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
return string(output), nil
|
o := string(output)
|
||||||
|
|
||||||
|
return vtclean.Clean(o, false), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *Item) initInteractiveShell(v []string) error {
|
func (i *Item) initInteractiveShell(v []string) error {
|
||||||
|
|
Loading…
Reference in New Issue