Variable: comint-redirect-filter-functions

List of functions to call before inserting redirected process output.
Each function gets one argument, a string containing the text received
from the subprocess. It should return the string to insert, perhaps
the same string that was received, or perhaps a modified or transformed
string.

The functions on the list are called sequentially, and each one is given
the string returned by the previous one. The string returned by the
last function is the text that is actually inserted in the redirection buffer.

You can use `add-hook' to add functions to this list either globally or locally.