Skip to content

Commit

Permalink
Merge pull request #1022 from divmain/sanitize_ansi
Browse files Browse the repository at this point in the history
sanitize ansi sequences
  • Loading branch information
stoivo committed Nov 14, 2018
2 parents 43d57d4 + ea98d36 commit 5f0e52f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/git_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
GIT_REQUIRE_PATCH = 0


ANSI_ESCAPE = re.compile(r'\x1B\[[0-?]*[ -/]*[@-~]')


class LoggingProcessWrapper(object):

"""
Expand Down Expand Up @@ -266,6 +269,9 @@ def initialize_panel():
raise GitSavvyError(
"`{}` failed.".format(command_str), show_panel=show_panel_on_stderr)

if stdout:
stdout = ANSI_ESCAPE.sub('', stdout)

return stdout

def decode_stdout(self, stdout):
Expand Down

0 comments on commit 5f0e52f

Please sign in to comment.