pgtoolkit/colordiff.py
changeset 63 8c7f0a51ba50
equal deleted inserted replaced
62:af637235ca81 63:8c7f0a51ba50
       
     1 from subprocess import Popen, PIPE
       
     2 
       
     3 
       
     4 def colordiff(diff):
       
     5     """Colorize diff output using external program colordiff"""
       
     6     try:
       
     7         p = Popen(["colordiff"], stdin=PIPE, stdout=PIPE, close_fds=True)
       
     8         outs, _errs = p.communicate(diff.encode('utf8'))
       
     9         return outs.decode('utf8')
       
    10     except OSError:
       
    11         return diff
       
    12