diff options
author | Sebastien Martini <seb@dbzteam.org> | 2010-07-27 15:25:17 +0200 |
---|---|---|
committer | Sebastien Martini <seb@dbzteam.org> | 2010-07-27 15:25:17 +0200 |
commit | 3fb456af85bdf73ae38b00ebc16a16777a858321 (patch) | |
tree | bbd853b64bfa2670a233c2381b9795fe10212b0f /python2 | |
parent | 817169ec933de0eaf0d98793ade01a89aabcc4ce (diff) | |
download | pyinotify-3fb456af85bdf73ae38b00ebc16a16777a858321.tar.gz |
Flush stdout stream immediately after events or stats are written
(idea submitted by hv@tbz-pariv.de).
Diffstat (limited to 'python2')
-rwxr-xr-x | python2/pyinotify.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/python2/pyinotify.py b/python2/pyinotify.py index 2bf9aea..430c467 100755 --- a/python2/pyinotify.py +++ b/python2/pyinotify.py @@ -882,6 +882,7 @@ class PrintAllEvents(ProcessEvent): """ self._out.write(str(event)) self._out.write('\n') + self._out.flush() class ChainIfTrue(ProcessEvent): @@ -2142,8 +2143,11 @@ def command_line(): cb_fun = None if options.stats: def cb(s): - print('%s\n%s\n' % (repr(s.proc_fun()), - s.proc_fun())) + sys.stdout.write(repr(s.proc_fun())) + sys.stdout.write('\n') + sys.stdout.write(str(s.proc_fun())) + sys.stdout.write('\n') + sys.stdout.flush() cb_fun = cb log.debug('Start monitoring %s, (press c^c to halt pyinotify)' % path) |