Skip to content

Commit

Permalink
Check for ANSI only inside strings (#13)
Browse files Browse the repository at this point in the history
Avoid exception when other data is received, like Segment.
  • Loading branch information
ssbarnea authored Nov 18, 2020
1 parent 4d45efc commit c947641
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/enrich/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def print(self, *args, **kwargs) -> None: # type: ignore
# Currently rich is unable to render ANSI escapes with print so if
# we detect their presence, we decode them.
# https://github.com/willmcgugan/rich/discussions/404
if "\033" in args[0]:
if isinstance(args[0], str) and "\033" in args[0]:
text = format(*args) + "\n"
decoder = AnsiDecoder()
args = list(decoder.decode(text)) # type: ignore
Expand Down

0 comments on commit c947641

Please sign in to comment.