This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
The following commit(s) were added to refs/heads/master by this push:
new ac17a21 Force flushing when encountering buffered output modes
ac17a21 is described below
commit ac17a21974a9cb4fb80b62b7c435944b62cbf742
Author: Daniel Gruno <[email protected]>
AuthorDate: Sat May 15 08:29:48 2021 +0200
Force flushing when encountering buffered output modes
---
server/main.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/server/main.py b/server/main.py
index b707bc0..c811cc2 100644
--- a/server/main.py
+++ b/server/main.py
@@ -40,6 +40,13 @@ import plugins.session
PONYMAIL_FOAL_VERSION = "0.1.0"
+# Certain environments such as MinGW-w64 will not register as a TTY and uses
buffered output.
+# In such cases, we need to force a flush of each print, or nothing will show.
+if not sys.stdout.buffer.isatty():
+ import functools
+ print = functools.partial(print, flush=True)
+
+
class Server(plugins.server.BaseServer):
"""Main server class, responsible for handling requests and scheduling
offloader threads """