From anonymous, 2 Months ago, written in Python.
Embed
  1. if '\r' in text:
  2.     text = text.rsplit('\r', maxsplit=1)[-1]  # everything after last \r
  3.     self.stdout = self.stdout.rsplit('\n', maxsplit=1)[0] + '\n'
  4. self.stdout += text