Commits

Nikolaj Sjujskij  committed a61eaa0

ino_watch: unify `pager` decorator to deal with both `str`s and `unicode`

  • Participants
  • Parent commits 94cc459

Comments (0)

Files changed (1)

File inotify_watcher.py

     def paging_wrapper(*args, **kwargs):
         import sys
         output = f(*args, **kwargs)
+        if isinstance(output, unicode):
+            output = output.encode('utf-8')
         pager = subprocess.Popen(PAGER_OPTS, stdin=subprocess.PIPE)
-        pager.stdin.write(output.encode('utf-8'))
+        pager.stdin.write(output)
         pager.stdin = sys.stdin
         return None
     return paging_wrapper