diff options
Diffstat (limited to 'api/docker.go')
| -rw-r--r-- | api/docker.go | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/api/docker.go b/api/docker.go index c79b76d..551c818 100644 --- a/api/docker.go +++ b/api/docker.go @@ -5,7 +5,6 @@ import ( "fmt" "io" "log/slog" - "regexp" "time" "github.com/docker/docker/api/types/container" @@ -14,38 +13,6 @@ import ( const vttContainerId string = "foundry-foundry-1" -// Strip ansi control characters from source -// -// The source reader is automatically closed when stripper reader is -type ansiStripper struct { - regex regexp.Regexp - source io.ReadCloser -} - -func NewAnsiStripper(source io.ReadCloser) *ansiStripper { - striper := new(ansiStripper) - striper.regex = *regexp.MustCompile(`\x1b[[0-9;]*m`) - striper.source = source - - return striper -} - -func (rc ansiStripper) Read(p []byte) (int, error) { - n, err := rc.source.Read(p) - if err != io.EOF && err != nil { - return n, err - } - - stripped := rc.regex.ReplaceAll(p[:n], []byte("")) - n = copy(p, stripped) - - return n, err -} - -func (rc ansiStripper) Close() error { - return rc.source.Close() -} - func stopVtt(ctx context.Context) error { apiClient, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation()) if err != nil { |
